Skip to content

@mega-yfue/eufy-sdk / MegaApiError

Class: MegaApiError

A mega API call the server answered with a non-zero envelope code, carrying that code rather than only a message.

The retry/auth logic here already decides what to do by NUMBER (4416, 10000, 4404, 26084), so the number is the authoritative fact about which condition was hit. Formatting it into a message and throwing a bare Error left every caller that needs to tell one condition from another parsing this module's message format back apart — a decision that belongs to the layer that owns the wire, not to whoever reads it.

Extends

  • Error

Constructors

Constructor

ts
new MegaApiError(
   message, 
   code, 
   status
): MegaApiError;

Parameters

message

string

code

number | undefined

The envelope's code, or undefined when the failure produced no envelope.

status

number | undefined

The HTTP status the envelope arrived with.

Returns

MegaApiError

Overrides

ts
Error.constructor

Properties

code

ts
readonly code: number | undefined;

The envelope's code, or undefined when the failure produced no envelope.


status

ts
readonly status: number | undefined;

The HTTP status the envelope arrived with.

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations, Anker eufy, or eufy. "Anker eufy", "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.