onError method
Records a connection-level error not tied to a single frame.
Implementation
@override
void onError(Object error, StackTrace stackTrace, {String? url}) {
if (!settings.enabled) return;
final useRedaction = settings.enableRedaction;
final (url: normalizedUrl, path: path) = _normalizeUrl(url, useRedaction);
final preview = ISpectLogData(
'error $normalizedUrl',
key: ISpectLogType.wsError.key,
additionalData: {
TraceKeys.category: wsCategory.id,
TraceKeys.source: source,
TraceKeys.operation: 'error',
TraceKeys.target: normalizedUrl,
TraceKeys.success: false,
TraceKeys.correlationId: _connectionId,
},
);
if (!settings.shouldProcessError(preview)) return;
_logger.wsReceive(
source: source,
operation: 'error',
target: normalizedUrl,
error: error,
errorStackTrace: stackTrace,
correlationId: _connectionId,
config: useRedaction ? null : NetworkRedactionMixin.noRedactConfig,
meta: {'url': normalizedUrl, 'path': path},
);
}