mapError
n8n-nodes-semble / core/ErrorMapper / mapError
Function: mapError()¶
mapError(
error
,context
):SembleError
Defined in: core/ErrorMapper.ts:458
Convenience function for quick error mapping with context
Provides a simple interface to the default error mapper for transforming raw errors into structured Semble errors with appropriate context and user-friendly messages.
Parameters¶
error¶
any
The raw error to map (can be any type)
context¶
ErrorContext
= {}
Additional context for error mapping
Returns¶
Structured SembleError with proper type and messaging
Example¶
try {
await sembleApi.getPatients();
} catch (error) {
const mappedError = mapError(error, {
operation: 'patient_retrieval',
resource: 'patients',
userId: 'user123'
});
throw mappedError;
}
Since¶
2.0.0