Maps a B2 error response to the appropriate B2Error subclass.
Uses known error codes for exact matching, then falls back to HTTP status
codes for unknown future B2 codes.
Maintainer note: when B2 documents a new error code, add it to
KNOWN_B2_ERROR_CODES in src/types/errors.ts and add a matching
classifyKnownError switch case. Unknown codes fall through to the
HTTP-status-based heuristic and finally to a generic B2Error, which is
safe but loses semantic specificity (the caller can't instanceof against
a precise subclass and the retry decision relies on status alone).
Maps a B2 error response to the appropriate B2Error subclass. Uses known error codes for exact matching, then falls back to HTTP status codes for unknown future B2 codes.
Maintainer note: when B2 documents a new error code, add it to
KNOWN_B2_ERROR_CODESinsrc/types/errors.tsand add a matchingclassifyKnownErrorswitch case. Unknown codes fall through to the HTTP-status-based heuristic and finally to a genericB2Error, which is safe but loses semantic specificity (the caller can'tinstanceofagainst a precise subclass and the retry decision relies on status alone).