#Error Handling

0 Followers · 84 Posts

Error handling refers to the response and recovery procedures from error conditions present in a software application. It is the process comprised of anticipation, detection and resolution of application errors, programming errors or communication errors.

Learn more.

Discussion Evgeny Shvarov · Sep 28, 2020

Hi developers!

Want to discuss with you the case of %Status.

If you familiar with ObjectScript you know what is it. I'd love to hear the history of the case why it had appeared in ObjectScript but it turned out that almost every system/library classmethods return %Status and there is a whole set of tools to deal with it.

What is does it gives you the responsibility to check the value or %Status of every system method you call.

E.g. if you save the data of the persistent class,  you should never call like this:

do obj.%Save()

you need to call:

19
0 1232
Article Daniel Tamajon · Sep 1, 2020 5m read

Error management on InterSystems languages has been evolving along time. Next, we will show the different implementations and why you should use the TRY/THROW/CATCH mechanism.

You can read official error recommendations here.

InterSystems will not mark as obsoletes the non-recommended error management methods to allow giving support to legacy applications. We recommend using tools like objectscriptQuality to detect that legacy unrecommended usage along with many other possible issues and bugs.

$ZERROR

2
3 939
Question Scott Roth · Aug 12, 2020

We have a vendor that every couple of days will just stop transmitting messages, but still hold the TCP/IP connection open. No matter how many times we troubleshoot and talk with them, they don't seem to think its an issue with system.  Normally if I just restart the service it will get the data flowing again.

I know ideal is for them to fix the issue, but in the meantime I have setup an Inactivity time out alert.  I was wondering with the correct filtering if there was a way to say if the Inactivity Alert is triggered during the business day, to have the Alert trigger a restart of the service?

3
0 310
Article Evgeny Shvarov · Aug 2, 2020 1m read

Hi Developers!

As you know the application errors live in ^ERRORS global. They appear there if you call:

d e.Log() 

in a Catch section of Try-Catch.

With @Robert Cemper's approach, you can now use SQL to examine it.

Inspired by Robert's module I introduced a simple IRIS Analytics module which shows these errors in a dashboard:

5
1 387
Article Timothy Leavitt · Jan 15, 2020 9m read

Introduction and Motivation

A unit of ObjectScript code (a ClassMethod, say) may produce a variety of unexpected side effects by interacting with parts of the system outside of its own scope and not properly cleaning up. As a non-exhaustive list, these include:

  • Transactions
  • Locks
  • I/O devices
  • SQL cursors
  • System flags and settings
  • $Namespace
  • Temporary files
7
6 1527
Question Kevin Clancy · Mar 26, 2020

The intersystems documentation gives the same description for both <MAXSTRING> and <NETWORK DATA UPDATE FAILED - MAXSTRING>. I suspect that the description for <MAXSTRING> is correct and the description for <NETWORK DATA UPDATE FAILED - MAXSTRING> was an accident. I would like to know what situation triggers the <NETWORK DATA UPDATE FAILED - MAXSTRING> error.

2
0 466
Question Jack Smith · Oct 27, 2019

We have a data transformation where source is object collection (populated from a json file)  and target is EnsLib.EDI.XML.Document.

If source file is large enough, transformation fails and we get <store> error and I quickly found this:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=EBPLR_DTL_foreach which at the bottom in "Avoiding <STORE> Errors with Large Messages" section tells to: 

1
0 520
Question Stephen Wilson · Mar 11, 2020

There does not seem to be any separation between the error code and error text in a %Status object. For custom errors, I simply want to display the message and not Error #5001: Some error text.

ClassMethodIsNonNullCustomerID(pCustomerIDAs%String) As%Status  {
Quit:(pCustomerID="")$$$ERROR($$$GeneralError,"CustomerID is not valid")
Quit$$$OK
}

The various methods described here to retrieve the error text always show

Error  #5001: CustomerID not valid
5
0 706
Question Vikram Annadurai · Dec 20, 2019

Hello All,

I have connected InterSystems Cache remote server from Power BI using ODBC Connection . But I am not able to view the data records on Power BI getting some error "Value cannot be null. Parameter name: exceptionType". And also I checked with that remote server with the location   System > System Logs > View xDBC Error Log > xDBC Errors . On that place I can see the below error

2
0 882
Article Pravin Barton · Mar 28, 2019 2m read

ObjectScript has at least three ways of handling errors (status codes, exceptions, SQLCODE, etc.). Most of the system code uses statuses but exceptions are easier to handle for a number of reasons. Working with legacy code you spend some time translating between the different techniques. I use these snippets a lot for reference. Hopefully they're useful to others as well.

5
23 3886
Question Abbad Minhas · Nov 11, 2019

I have the following class: 

Class P.RA.SII.F
{


Query ClosedFutures(FromDate As %Date, ToDate As %Date) As %Query(ROWSPEC = "FundCode:%String, Asset:%String, TradeDate:%Date,BuySell:%String, Price:Data.Common.Numeric, Quantity:%Numeric, CumulativePosition:%Numeric, PreviousCumulativePosition:%Numeric, ClosingTrades:%Integer, ClosingTradesInPeriod:%Integer, ClosedTradeValueInPeriod:Data.Common.Numeric, NetQuantityInPeriod:%Integer, WeightedClosedAverageTradePriceInPeriod:Data.Common.Numeric, InitialTradeDate:%Date, InitialTrade:%Integer, LastInPeriod:%Integer") [ SqlProc ]
{
}

3
0 257
Question Yaron Munz · Apr 11, 2019

In a Business Process (BPL) I noticed that if I 'm using a "scope" to handle errors  then inside the "scope" when a "call" is used, the "request" and "response" action (i.e set for callrequest.prop = request.prop & response.prop = callrespones.prop does NOT work !
The result is that the values of those properties in the callrequest  are nulls (I do see the properties names in the content of the callrequest message)

1
0 344
Question Jose Antonio Cañizares · Mar 5, 2019

Hi all,

Lets imagine that there's a process that locks an entry of a gived domain, in my example the ID 2 of the table User.tApplications and using an exclusive lock.  Additionally the error handling is managed by a $ETrap routine wich will look for error data in order to log it

Set $ETrap = "Do Err1^ErrRoutine"

Set obj = ##class(User.tApplications).%OpenId(2,"4",.errors)

If ($System.Status.IsError(errors){// Error: ERR_PESSIMISTIC_LOCK   Set $ECode = <MyerrorCode>}

When a  second process try to do the same action will cause an error informing that there's a lock (that is ok)

1
0 378
Question Guillaume Lepretre · Jun 20, 2018

Hello,

I used the operation : EnsLib.EMail.AlertOperation to send mail to handle error. However, I want to get more information about the error (session ID message, the date, the namespace... etc).

what is the best way to do it?

I tried to add informations in OnAlertRequest method as below but I need to change mail operation from all namespaces...

4
0 605
Question Hans Rietveld · Aug 29, 2017
Caché Version String: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2016.2.1

 

We have a mirrored Ensemble system (110,  backup and 210, primary). At one time (14:00) there is a disruption in the production. The messages are not being processed. 

Looking at the pButtons (every 10 seconds) I see the following abnormal at the WDphase

and the backup

The different values of WDphase are:

0: Idle (WD is not running)

5: WD is updating the Write Image Journal (WIJ) file.

7: WD is committing WIJ and Journal.

8: Databases are being updated.

3
0 880
Question Don Rozwick · Mar 20, 2017

I have an XML I am sending to an operation from a BPL.  This is a query for Patient information from Epic using a web service.  I created the operation using the add-in in Studio.  I setup the BPL to do a Call and send whatever data I receive from the client.  I get a response back from Epic with a list of matching Patients.  In the BPL I am trying to use the Response Builder to pass the response ID, name, DOB, etc. to matching context items to then pass to the client as a response.  I get the following error within the call:

4
0 1157
Question Anzelem Sanyatwe · Jan 18, 2017

I’ve a server that is running Windows Server 2003 R2 Enterprise Edition SP2 x86.

I just noted that you cannot allocate shared memory beyond 1.6GB.

 

Is this a known problem between Cache and this OS architecture, and has anyone configured it beyond this?

 

Cache gives the below errors (Version: Cache for Windows (x86-32) 2012.2.5 (Build 962_1) Wed Jun 11 2014 13:58:32 EDT).

 

11/01/16-08:33:06:750 (0) 2 Failed to allocate 2560MB shared memory: 2045MB global buffers, 384MB routine buffers

11/01/16-08:33:08:843 (0) 2 Failed to allocate 1934MB shared memory using large pages.  Switching to small pages.

2
0 1556
Question Josh Tennefoss · Dec 9, 2016

How can I prevent large number truncation when using the DynamicObject and DynamicArray classes to create JSON in objectscript and then parsing the result in javascript. Are there any global settings that configure the output when using these classes?

I am looking at converting to the new DynamicObject and DynamicArray classes to build JSON. Our current (homegrown) JSON library forces string representation of numbers too long because of errors we were seeing with long numbers being truncated on the client, I am hoping to accomplish the same with the new classes.

2
0 1356
Article Istvan Hahn · Oct 6, 2016 4m read

A beginner’s guide to Exception Handling in RESTful web services. The article gives an example how the various error conditions during processing a service request can be handled.

We expect our client – server communication working in a flawless operational condition, running error free software. But we are prepared to handle exceptions. Are we? So far in the examples of the previous sessions were not. We did not care about exceptions. The result? In any error incident it took ages to figure out what the problem is and more importantly how to fix it.

1
0 1860