Hyperlinkv0.8.0-beta.28

ErrorReporter

ErrorReporter.getAttributesconsteffect/ErrorReporter.ts:539
(error: object): ReadonlyRecord<string, unknown>

Reads the ErrorReporter.attributes annotation from an error object, returning an empty record when unset.

When to use

Use to inspect the attributes that reporter callbacks will receive for an object error.

Details

Returns the value stored under ErrorReporter.attributes, or the module's shared empty record when the annotation is absent.

Gotchas

The annotation value is returned as-is; this helper does not validate or clone it.

export const getAttributes = (error: object): ReadonlyRecord<string, unknown> => {
  return attributes in error ? error[attributes] as any : emptyAttributes
}
Referenced by 1 symbols