Issue #11303: Improve FITS import error handling
This patch attempts to resolve #11303 (closed) by moving error-handling code to before the variable is used.
This patch attempts to resolve #11303 (closed) by moving error-handling code to before the variable is used.