encodeException static method

Map<String, dynamic> encodeException(
  1. OmnyStoreException e
)

Renders an OmnyStoreException into an RPC error payload.

The typed hierarchy has to survive the node→hub hop: a client asking the hub for a missing release should get ReleaseNotFoundException, not a generic "node call failed". The code travels, and exceptionFrom reconstructs it.

Implementation

static Map<String, dynamic> encodeException(OmnyStoreException e) => {
  'error': {
    'code': e.code,
    'message': e.message,
    'statusCode': e.statusCode,
    if (e.details.isNotEmpty) 'details': e.details,
  },
};