declare() function throws Internal error and cannot be caught with try-catch

Hello,

I’m facing an issue with the declare() function in my provisioning script.

Here is a simplified example:

try {let RXPower = declare(“InternetGatewayDevice.WANDevice.1.X_GponInterafceConfig.CATVRXPower”,{ value: Date.now() }).value[0];} catch (e) {
}

When the device responds with an error (e.g., faultCode: 9002, faultString: "Internal error"), the script execution stops immediately. The exception is not caught by the try-catch block, and the whole task fails.

My problem is that I cannot reach the next line after declare() when this happens, so I cannot handle the error gracefully inside the script.

  • Is this the expected behavior of declare()?

  • Is there any way to check the existence/availability of a parameter (or catch such errors) before calling declare() with a value?

  • How should we safely handle parameters that may not exist or may throw Internal error without killing the whole task?

Any guidance or best practices would be greatly appreciated.

Thanks in advance!

GenieACS won’t perform a SPV if the parameter doesn’t exist on the CPE.

What is in the syslog on the CPE? You may have to crack the unit open and connect to the serial header to get better diagnostic information.