Add specific exception classes for DLMS related errors

Project: 
Gurux.DLMS.Net

Right now, if I try to fetch an object that doesn't exist, I get this:

"Access Error : Device reports a undefined object."

Which relies heavily on the string.

It would be sweet to receive a custom exception called UndefinedObjectException which contains the message and perhaps the OBIS code of the object that I tried to access.

// Miro

Status: 
Closed (works as designed)
Priority: 
Normal
Category: 
Feature request
Component: 
Code
Reporter: 
AndreasAtPowel
Created: 
Wed, 07/01/2020 - 12:26
Updated: 
Wed, 08/05/2020 - 11:29

Comments

Kurumi's picture

Hi,

You don't need to use strings. You can get the reason from the ErrorCode property.
OBIS code is not included in the error message and for this reason, it's not possible to add to the error.

The reason why there are not own error for each error code is that some meters are using their own custom errors.

Adding own error type for each of those errors is breaking the backward compatibility in some older projects and for this reason, we can't add it at the moment.

BR,
Mikko

Kurumi's picture

Status: Active » Closed (works as designed)

I see. I didn't know about the ErrorCode, I'll check that out!

// Miro