All errors thrown by FileKit extend the same TankerError base class and have the following fields:

Field Description
name the name of the (sub)class as a string
message additional details about the error

Here is the list of possible errors:

Error Description
InternalError Tanker internal error, thrown as a last resort
InvalidArgument Developer error, one of the function's argument is invalid
NetworkError Network error, e.g. connection lost or the Tanker server is not reachable
PreconditionFailed Developer error, a function's precondition was violated

Here is a code example demonstrating various levels of granularity in error handling:

import { errors } from '@tanker/filekit';

try {
  await fileKit.start(...);
} catch(e) {
  if (e instanceof errors.InvalidArgument) {
    /* specific FileKit error handling */
  } else if (e instanceof errors.TankerError) {
    /* generic Tanker error handling */
  } else {
    /* generic non-Tanker error handling */
  }
}