{"id":1641,"date":"2021-02-23T05:19:46","date_gmt":"2021-02-23T05:19:46","guid":{"rendered":"https:\/\/wtheiss.com\/wordpress\/?p=1641"},"modified":"2021-02-23T05:54:13","modified_gmt":"2021-02-23T05:54:13","slug":"more-on-error-messages","status":"publish","type":"post","link":"https:\/\/wtheiss.com\/wordpress\/?p=1641","title":{"rendered":"More on error messages &#8230;"},"content":{"rendered":"<p>Object generation 5.30 comes with some more script functions supporting error handling. We have generated a simple demo application in CODE which looks like this:<\/p>\n<p><a href=\"https:\/\/wtheiss.com\/wordpress\/wp-content\/uploads\/2021\/02\/error_message_demo.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-1644\" src=\"https:\/\/wtheiss.com\/wordpress\/wp-content\/uploads\/2021\/02\/error_message_demo-1024x637.png\" alt=\"\" width=\"474\" height=\"295\" srcset=\"https:\/\/wtheiss.com\/wordpress\/wp-content\/uploads\/2021\/02\/error_message_demo-1024x637.png 1024w, https:\/\/wtheiss.com\/wordpress\/wp-content\/uploads\/2021\/02\/error_message_demo-300x187.png 300w, https:\/\/wtheiss.com\/wordpress\/wp-content\/uploads\/2021\/02\/error_message_demo-768x477.png 768w, https:\/\/wtheiss.com\/wordpress\/wp-content\/uploads\/2021\/02\/error_message_demo.png 1483w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>While some measurement routines (list of spectrometers) and other procedures produce error messages by themselves you can generate error message by a script command:<\/p>\n<ul>\n<li>raise error message,0,1,This is wrong &#8211; user tried do divide by 0<\/li>\n<li>raise error message,0,2,This is a warning only ..<\/li>\n<\/ul>\n<p>Here the first integer parameter indicates the type of error, the second one the classification. &#8216;1&#8217; means &#8216;critical error&#8217;, &#8216;2&#8217; stands for warning.<\/p>\n<p>The script command &#8216;verify function value&#8217; automatically raises an error message if the condition the function value is out of range. You can add the keyword &#8216;silent&#8217; to suppress a dialog popping up &#8211; in this case the classification is &#8216;Warning&#8217;. Without the keyword you get a dialog and classification &#8216;critical error&#8217;:<\/p>\n<ul>\n<li>verify function value,of(1),0.3,0.4,reflectance maximum,silent<\/li>\n<li>verify function value,of(1),0.3,0.4,reflectance maximum<\/li>\n<\/ul>\n<p>Error messages get a timestamp and are collected in an array until the script command &#8216;clear error messages&#8217; is executed.<\/p>\n<p>If you use CODE to acquire spectra with a spectrometer object you can generate measurement reports which collect all measured spectra for a sample &#8211; these are JSON files. Should there be warnings issued by the measurement scripts the corresponding error messages are stored in the &#8216;error section&#8217; of the JSON files as well.<\/p>\n<p>The new view element &#8216;error messages view&#8217; shows error messages in a view.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Object generation 5.30 comes with some more script functions supporting error handling. We have generated a simple demo application in CODE which looks like this: While some measurement routines (list of spectrometers) and other procedures produce error messages by themselves you can generate error message by a script command: raise error message,0,1,This is wrong &#8211; [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,2,29,28,4,8],"tags":[],"_links":{"self":[{"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1641"}],"collection":[{"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1641"}],"version-history":[{"count":4,"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1641\/revisions"}],"predecessor-version":[{"id":1646,"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1641\/revisions\/1646"}],"wp:attachment":[{"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wtheiss.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}