These docs are for v1.0. Click to read the latest docs for v2.0.

Error Codes

Asleep.setDebugLoggerDelegate()

let delegate: AsleepDebugLoggerDelegate = self
Asleep.setDebugLoggerDelegate(self)
protocol AsleepDebugLoggerDelegate {
    func didPrint(message: String)
}
Property NameTypeDescription
messageStringLog message

Asleep.AsleepError

enum AsleepError: Error {
    case unknown(systemError: Error)
    case shouldResume
    case over24hours
    case responseResult(endpoint: String)
    case httpStatus(code: Int, errorCode: Int, message: String?)
}

unknown: Unknown system error

  • systemError: Error - error due to system

shouldResume: unable to resume microphone recording after interrupt

over24Hours: recording exceeded 24 hours and is forcibly stopped

  • The Asleep SDK does not support sleep tracking exceeding 24 hours.

responseResult: error due to api reponse result value

  • endpoint - The endpoint where the problem occurred

httpStatus: http error

  • code: Int - 400 or more http code
  • errorCode: Int - specific error code - in dev
  • message: String - error reason explanation

HTTP Status code

CodeError code(TBD)TypeDescription
401UnauthorizedUnauthorized
403Plan is expiredPlan is expired
403Rate limit exceededRate limit exceeded
403Quota exceededQuota exceeded
401UnauthorizedNot authorized customer uuid
401Unauthorizeduser_agent is empty
409ConflictPrevious sleep session not yet closed
422Validation ErrorInvalid session start time (YYYY-MM-DDTHH:mm:ssz)
422Validation ErrorInvalid parameter
403ForbiddenSession already terminated
404Not FoundSession does not exist
400Bad RequestNot valid callback_url
400Bad RequestAudio format <sleep_session.sleep_sound_length> sec (16khz, 44.1khz, 48khz) (mp3, wav) less than 10MB
400Bad RequestMELSPECTROGRAM file cannot be uploaded. Only AUDIO file can be uploaded.
413Request Entity Too LargeHTTP length exceeded 16777216 bytes
422Unprocessable EntityNot valid parameter
403ForbiddenSleep session has already ended
400Bad Request[WARNING] Invalid session end time. format(YYYY-MM-DDTHH:mm:ssz), 'session_end_time' must always be greater than 'session_start_time'
404Not FoundSession doesn't exist
400Bad RequestInvalid time zone provided
401UnauthorizedAPI key is not provided
404Not Foundsleep session id {session_id} cannot be found
422Unprocessable Entityid {session_id}format is not valid