UVES Pipeline Reference Manual
5.4.0
|
Macros | |
#define | assure(BOOL, CODE,...) irplib_error_assure(BOOL, CODE, (__VA_ARGS__), goto cleanup) |
#define | assure_nomsg(BOOL, CODE) irplib_error_assure(BOOL, CODE, (" "), goto cleanup) |
#define | assure_mem(PTR) |
#define | ck0(IEXP,...) |
#define | ck0_nomsg(IEXP) ck0(IEXP," ") |
#define | cknull(NULLEXP,...) |
#define | cknull_nomsg(NULLEXP) cknull(NULLEXP," ") |
#define | check(CMD,...) |
#define | check_nomsg(CMD) check(CMD, " ") |
#define | passure(BOOL,...) |
#define | uves_error_reset() irplib_error_reset() |
#define | uves_error_dump() irplib_error_dump(CPL_MSG_ERROR, CPL_MSG_ERROR) |
Warning: this documentation is outdated. Please refer to the documentation of the error handler in IRPLIB.
This error handling module extends CPL's error handler by adding error tracing and automatic memory deallocation in case of an error. Like in CPL the current error state is indicated by the cpl_error_code
(returned by the function cpl_error_get_code()
).
The error tracing makes it possible to see where (source file, function name, line number) an error first occured, as well as the sequence of function calls preceding the error. A typical output looks like:
However, the main motivation of this extension is to simplify the error checking and handling. A single line of source code
has the same effect as
This of course makes the source code more compact and hence easier to read (and maintain) and allows for intensive error checking with minimal effort.
Additionally, editing the check()
macro (described below) allows for debugging/tracing information at every function entry and exit.
New errors are set with the macros assure()
and passure()
, and sub-functions that might set a cpl_error_code
are checked using the macros check()
and pcheck()
. The function _uves_error_set()
should never be called directly. These macros check if an error occured and, if so, jumps to the cleanup
label which must be defined at the end of each function. After the cleanup
label every pointer used by the function is deallocated and the function returns. Also a string variable named fctid
(function identification), must be defined in every function and contain the name of the current function.
At the very end of a recipe the error state should be checked and uves_error_dump()
called on error:
When using this scheme:
return
statement per function (after the cleanup
label).Consider the example
This is easily fixed:
(Note that uves_free_image()
et al. can be used instead of cpl_image_delete()
et al. as a way to ensure that a pointer is always set to NULL after deallocation).
To recover from an error, call uves_error_reset()
, not cpl_error_reset()
. Example:
However, error recovery is usually best avoided, and the functionality above is better written as:
#define assure_nomsg | ( | BOOL, | |
CODE | |||
) | irplib_error_assure(BOOL, CODE, (" "), goto cleanup) |
Condition
Definition at line 177 of file uves_error.h.
Referenced by create_line_table(), create_order_table(), flames_midas_sccadd(), flames_midas_scccre(), flames_midas_sccfnd(), flames_midas_sccget(), flames_midas_sccsho(), flames_midas_scdfnd(), flames_midas_scdprs(), flames_midas_scfget(), flames_midas_scfput(), flames_midas_sckgetc(), flames_midas_sckgetc_fs(), flames_midas_sckgetc_fsp(), flames_midas_sckrdd(), flames_midas_sckrdr(), flames_midas_sckwrc(), flames_midas_sckwrd(), flames_midas_sckwri(), test_iterate(), test_process(), uves_align(), uves_hough(), uves_locate_orders(), uves_normalize_spectrum(), uves_polynomial_fit_1d(), uves_reduce(), and uves_spline_cubic().
#define assure_mem | ( | PTR | ) |
Memory allocation
Definition at line 181 of file uves_error.h.
Referenced by calibrate_global(), filter_median(), flames_midas_scdrdi(), get_descr_info(), identify_lines(), opt_measure_profile(), opt_measure_profile_order(), opt_sample_spatial_profile(), opt_subtract_sky(), revise_noise(), test_bad_corr(), test_gaussian_fitting(), test_process(), tflat_qclog(), uves_create_image(), uves_define_noise(), uves_end(), uves_extract(), uves_get_blaze_ratio(), uves_lt_new(), uves_pfits_get_wend(), uves_pfits_get_wstart(), uves_pfits_set_wend(), uves_pfits_set_wstart(), uves_polynomial_collapse(), uves_polynomial_fit_2d(), uves_polynomial_new(), uves_polynomial_new_zero(), uves_polynomial_regression_2d_autodegree(), and uves_rebin().
#define ck0 | ( | IEXP, | |
... | |||
) |
Definition at line 184 of file uves_error.h.
#define cknull | ( | NULLEXP, | |
... | |||
) |
Definition at line 190 of file uves_error.h.
#define check | ( | CMD, | |
... | |||
) |
cpl_error_code + message
Definition at line 198 of file uves_error.h.
Referenced by calculate_spacing(), calibrate_global(), compute_lambda(), create_descr(), delete_peak(), detect_lines(), detect_ripples(), estimate_threshold(), extract_ff_rebin_merge(), extract_order_simple(), fit_order_linear(), flames_midas_sccfnd(), flames_midas_sccget(), flames_midas_scddel(), flames_midas_scdfnd(), flames_midas_scdprs(), flames_midas_scdrdi(), flames_midas_scfget(), flames_midas_scfinf(), flames_midas_scfput(), flames_midas_tccini(), flames_midas_tccser(), flames_midas_tciget(), flames_midas_tcsget(), flames_midas_tcsput(), frame_close(), get_descr_info(), get_orderlength(), get_xcenter(), get_ycenter(), load_frame(), load_frame_header(), load_header(), main(), opt_define_sky(), opt_extract(), opt_extract_sky(), opt_measure_profile(), opt_measure_profile_order(), opt_reject_outlier(), parse_history(), repeat_orderdef(), revise_noise(), scdcop(), scdrd(), scdwr(), subtract_sky(), subtract_sky_row(), table_colname_from_number(), test_bad_corr(), test_extract(), test_gaussian_fitting(), test_iterate(), test_load_3dtable(), test_process(), tflat_qclog(), trace_order(), uves_align(), uves_baryvel(), uves_calculate_response(), uves_ccd_is_new(), uves_combine_flats(), uves_correct_badpix(), uves_correct_badpix_all(), uves_define_noise(), uves_delete_bad_lines(), uves_draw_lines(), uves_draw_orders(), uves_extract(), uves_filter_image_median(), uves_fit_gaussian_2d_image(), uves_flames_pfits_get_dit(), uves_flames_pfits_get_ident(), uves_flames_pfits_get_nflats(), uves_flames_pfits_get_object(), uves_flames_pfits_get_plateid(), uves_flames_pfits_set_ccfposmax(), uves_flames_pfits_set_newplateid(), uves_flat_create_normalized_master(), uves_flat_create_normalized_master2(), uves_flatfielding(), uves_format_is_new(), uves_get_blaze_ratio(), uves_get_extract_method(), uves_get_flatfield_method(), uves_get_merge_method(), uves_hough(), uves_initialize(), uves_initialize_image_header(), uves_locate_orders(), uves_merge_orders(), uves_mflat_at_ypos(), uves_mflat_exe_body(), uves_mflat_process_chip(), uves_msflats(), uves_normalize_spectrum(), uves_ordertable_traces_add(), uves_ordertable_traces_new(), uves_pfits_get_airmass_end(), uves_pfits_get_airmass_start(), uves_pfits_get_ambipress(), uves_pfits_get_arcfile(), uves_pfits_get_badpxframe(), uves_pfits_get_binx(), uves_pfits_get_biny(), uves_pfits_get_bitpix(), uves_pfits_get_bscale(), uves_pfits_get_bunit(), uves_pfits_get_ccdid(), uves_pfits_get_cdelt1(), uves_pfits_get_cdelt2(), uves_pfits_get_chip_name(), uves_pfits_get_chipchoice(), uves_pfits_get_chipid(), uves_pfits_get_conad(), uves_pfits_get_crpix1(), uves_pfits_get_crpix2(), uves_pfits_get_crval1(), uves_pfits_get_crval2(), uves_pfits_get_ctype1(), uves_pfits_get_ctype2(), uves_pfits_get_cunit1(), uves_pfits_get_cunit2(), uves_pfits_get_datancom(), uves_pfits_get_date_obs(), uves_pfits_get_dec(), uves_pfits_get_dpr_catg(), uves_pfits_get_dpr_tech(), uves_pfits_get_dpr_type(), uves_pfits_get_drs_id(), uves_pfits_get_exptime(), uves_pfits_get_gain(), uves_pfits_get_geolat(), uves_pfits_get_geolon(), uves_pfits_get_gratid(), uves_pfits_get_gratname(), uves_pfits_get_gratwlen(), uves_pfits_get_humidity(), uves_pfits_get_insmode(), uves_pfits_get_inspath(), uves_pfits_get_maxfibres(), uves_pfits_get_mjdobs(), uves_pfits_get_naxis(), uves_pfits_get_naxis1(), uves_pfits_get_naxis2(), uves_pfits_get_nx(), uves_pfits_get_ny(), uves_pfits_get_ocs_simcal(), uves_pfits_get_offset(), uves_pfits_get_ordpred(), uves_pfits_get_origfile(), uves_pfits_get_out1nx(), uves_pfits_get_out1ny(), uves_pfits_get_out4nx(), uves_pfits_get_out4ny(), uves_pfits_get_ovrscanx(), uves_pfits_get_ovrscany(), uves_pfits_get_pipefile(), uves_pfits_get_pixelscale(), uves_pfits_get_prescanx(), uves_pfits_get_prescany(), uves_pfits_get_pressure(), uves_pfits_get_pro_catg(), uves_pfits_get_ra(), uves_pfits_get_readspeed(), uves_pfits_get_rec1raw1name(), uves_pfits_get_ron_adu(), uves_pfits_get_slit1_name(), uves_pfits_get_slit3_x1encoder(), uves_pfits_get_slit3_x2encoder(), uves_pfits_get_slitlength(), uves_pfits_get_slitlength_pixels(), uves_pfits_get_slitwidth(), uves_pfits_get_startx(), uves_pfits_get_starty(), uves_pfits_get_targ_name(), uves_pfits_get_tempcam(), uves_pfits_get_templateid(), uves_pfits_get_tpl_start(), uves_pfits_get_uit(), uves_pfits_get_utc(), uves_pfits_get_wend(), uves_pfits_get_wstart(), uves_pfits_set_badpixcorr(), uves_pfits_set_bscale(), uves_pfits_set_bunit(), uves_pfits_set_bunit_no(), uves_pfits_set_cdelt1(), uves_pfits_set_cdelt2(), uves_pfits_set_crpix1(), uves_pfits_set_crpix2(), uves_pfits_set_crval1(), uves_pfits_set_crval2(), uves_pfits_set_ctype1(), uves_pfits_set_ctype2(), uves_pfits_set_cunit1(), uves_pfits_set_cunit2(), uves_pfits_set_data_average(), uves_pfits_set_data_max(), uves_pfits_set_data_median(), uves_pfits_set_data_min(), uves_pfits_set_data_stddev(), uves_pfits_set_dec(), uves_pfits_set_dpr_catg(), uves_pfits_set_dpr_tech(), uves_pfits_set_dpr_type(), uves_pfits_set_exptime(), uves_pfits_set_history_val(), uves_pfits_set_hs(), uves_pfits_set_object(), uves_pfits_set_ocs_simcal(), uves_pfits_set_ordpred(), uves_pfits_set_ra(), uves_pfits_set_redlevel(), uves_pfits_set_starttime(), uves_pfits_set_status(), uves_pfits_set_stoptime(), uves_pfits_set_tunit_no(), uves_pfits_set_wend(), uves_pfits_set_wstart(), uves_physmod_calmap(), uves_physmod_center_gauss(), uves_physmod_chop_otab(), uves_physmod_create_table(), uves_physmod_msrawxy(), uves_physmod_plotmod(), uves_physmod_qc1pmtbl(), uves_physmod_regress_echelle(), uves_physmod_stability_check(), uves_polynomial_convert_from_table(), uves_polynomial_derivative(), uves_polynomial_derivative_1d(), uves_polynomial_duplicate(), uves_polynomial_evaluate_1d(), uves_polynomial_fit_1d(), uves_polynomial_get_coeff_1d(), uves_polynomial_get_coeff_2d(), uves_polynomial_new(), uves_polynomial_regression_1d(), uves_polynomial_regression_2d(), uves_polynomial_regression_2d_autodegree(), uves_polynomial_solve_1d(), uves_polynomial_solve_2d(), uves_print_cpl_frameset(), uves_print_cpl_property(), uves_print_uves_propertylist(), uves_qclog_add_sci(), uves_rebin(), uves_reduce(), uves_reduce_mflat(), uves_reduce_mflat_combine(), uves_reduce_scired(), uves_response_efficiency(), uves_scired_process_chip(), uves_spline_hermite_table(), uves_subtract_bias(), uves_subtract_dark(), uves_utl_ima_arith(), uves_utl_physmod(), uves_utl_rcosmic(), uves_utl_remove_crh_single(), uves_wavecal_identify(), uves_wavecal_search(), and verify_calibration().
#define check_nomsg | ( | CMD | ) | check(CMD, " ") |
cpl_error_code
Definition at line 204 of file uves_error.h.
Referenced by calibrate_global(), convert_midas_array(), convert_to_history(), create_line_table(), create_order_table(), create_spectrum(), detect_lines(), extract_ff_rebin_merge(), extract_order_simple(), flames_align_table_column(), flames_midas_sccget(), flames_midas_tcbget(), flames_midas_tccini(), flames_midas_tcfget(), flames_midas_tclget(), flames_midas_tcuget(), flames_utl_unpack(), main(), opt_extract(), opt_measure_profile(), opt_measure_profile_order(), parse_midas_poly(), scdcop(), scired_qclog(), set_column_format_unit_tnull(), table_erase_selected(), tcerd(), tcewr(), test_3dtable(), test_extract(), test_iterate(), test_load_linetable(), test_polynomial(), test_polynomial_fit_2d(), tflat_qclog(), uves_average_reject(), uves_combine_flats(), uves_cosrout(), uves_delete_bad_lines(), uves_end(), uves_extract(), uves_flat_create_normalized_master(), uves_flat_create_normalized_master2(), uves_flatfielding(), uves_get_blaze_ratio(), uves_get_wave_map(), uves_hough(), uves_image_mflat_detect_blemishes(), uves_imagelist_get_clean_mean_levels(), uves_imagelist_subtract_values(), uves_ksigma_stack(), uves_ksigma_vector(), uves_locate_orders(), uves_mflat_at_ypos(), uves_mflat_combine_exe_body(), uves_mflat_define_parameters_body(), uves_mflat_one(), uves_mflat_process_chip(), uves_mflat_qclog(), uves_pfits_get_slitlength_pixels(), uves_physmod_align_tables(), uves_physmod_center_gauss(), uves_physmod_chop_otab(), uves_physmod_create_table(), uves_physmod_msrawxy(), uves_physmod_qc1pmtbl(), uves_physmod_stability_check(), uves_polynomial_regression_2d_autodegree(), uves_qclog_add_common_wave(), uves_qclog_add_sci(), uves_qclog_dump_common(), uves_qclog_dump_common_wave(), uves_qclog_init(), uves_rcosmic(), uves_rebin(), uves_reduce_mflat(), uves_reduce_mflat_combine(), uves_reduce_scired(), uves_remove_crh_single(), uves_tablename_remove_units(), uves_tablenames_unify_units(), uves_utl_ima_arith(), uves_utl_physmod(), uves_utl_rcosmic(), uves_utl_remove_crh_single(), and uves_wavecal_identify_lines_ppm().
#define passure | ( | BOOL, | |
... | |||
) |
assertion + message
Definition at line 207 of file uves_error.h.
Referenced by calibrate_global(), compute_lambda(), count_orders(), create_descr(), detect_lines(), estimate_sn(), estimate_threshold(), extract_ff_rebin_merge(), extract_order_simple(), find_centroid(), fit_order_linear(), flames_midas_scddel(), flames_midas_scdfnd(), flames_midas_scdprs(), flames_midas_scdwri(), flames_midas_scfcre(), flames_midas_scfget(), flames_midas_scfput(), flames_midas_tccini(), flames_midas_tccser(), flames_midas_tciget(), flames_midas_tcsget(), flames_midas_tcsput(), flames_midas_tctopn(), frame_close(), get_descr_info(), get_offset(), identify_lines(), load_frame(), load_frame_header(), opt_get_order_width(), opt_measure_profile(), opt_measure_profile_order(), opt_sample_spatial_profile(), scdcop(), scdrd(), scdwr(), subtract_sky(), table_colname_from_number(), table_dtype_to_cpltype(), uves_draw_lines(), uves_draw_orders(), uves_extract(), uves_flat_create_normalized_master(), uves_flatfielding(), uves_get_blaze_ratio(), uves_hough(), uves_image_mflat_detect_blemishes(), uves_ksigma_stack(), uves_locate_orders(), uves_merge_orders(), uves_polynomial_fit_2d(), uves_rebin(), uves_reduce(), uves_subtract_bias(), uves_subtract_dark(), uves_table_is_sorted_double(), uves_wavecal_identify(), uves_wavecal_search(), and xcenter().
#define uves_error_reset | ( | ) | irplib_error_reset() |
reset
Definition at line 215 of file uves_error.h.
Referenced by convert_midas_array(), find_centroid(), opt_get_order_width(), opt_measure_profile(), opt_measure_profile_order(), repeat_orderdef(), uves_draw_lines(), uves_get_blaze_ratio(), uves_locate_orders(), uves_polynomial_regression_2d_autodegree(), uves_rebin(), uves_wavecal_identify_lines_ppm(), and xcenter().
#define uves_error_dump | ( | ) | irplib_error_dump(CPL_MSG_ERROR, CPL_MSG_ERROR) |
dump
Definition at line 219 of file uves_error.h.