# Generated by tools/gen_errorcodes.nim. DO NOT EDIT!

when not defined(nimony):
  import errorcodes

proc httpToErrorCode*(err: int): ErrorCode =
  if err == 200 or err == 201 or err == 202:
    Success
  elif err == 500:
    Failure
  elif err == 416:
    RangeError
  elif err == 422:
    SyntaxError
  elif err == 507:
    DiskFullError
  elif err == 429:
    BusyError
  elif err == 403 or err == 401 or err == 407 or err == 405 or err == 406:
    PermissionDenied
  elif err == 408 or err == 504:
    TimeoutError
  elif err == 508:
    DeadlockError
  elif err == 400 or err == 415:
    BadOperation
  elif err == 501:
    UnimplementedOperation
  elif err == 414 or err == 431:
    NameTooLong
  elif err == 404:
    NameNotFound
  elif err == 413:
    ContentTooLong
  elif err == 421:
    BadLink
  elif err == 505:
    BadProtocol
  elif err == 502:
    UnreachableHost
  elif err == 511:
    AuthenticationRequired
  elif err == 308 or err == 307:
    RedirectError
  else:
    Failure

proc errorCodeToHttp*(err: ErrorCode): int =
  case err
  of Success: 200
  of Failure: 500
  of RangeError: 416
  of SyntaxError: 422
  of DiskFullError: 507
  of BusyError: 429
  of PermissionDenied: 403
  of TimeoutError: 408
  of DeadlockError: 508
  of BadOperation: 400
  of UnimplementedOperation: 501
  of NameTooLong: 414
  of NameNotFound: 404
  of ContentTooLong: 413
  of BadLink: 421
  of BadProtocol: 505
  of UnreachableHost: 502
  of AuthenticationRequired: 511
  of RedirectError: 308
  else: 500
