export class CloudError extends Error { constructor (message, { status = null, body = null, url = null, cause = null } = {}) { super(message, cause ? { cause } : undefined); this.name = 'CloudError'; this.status = status; this.body = body; this.url = url; } } // Not logged in, or the device token was rejected. export class AuthError extends CloudError { constructor (message, opts) { super(message, opts); this.name = 'AuthError'; } } // The root was changed by someone else between our read and our write. export class GenerationConflictError extends CloudError { constructor (message = 'root generation conflict', opts) { super(message, opts); this.name = 'GenerationConflictError'; } } export class NotFoundError extends CloudError { constructor (message, opts) { super(message, opts); this.name = 'NotFoundError'; } } // A path matched several documents. export class AmbiguousPathError extends CloudError { constructor (path, candidates) { super(`"${path}" is ambiguous, matches: ${candidates.map(c => `${c.id} (${c.name})`).join(', ')}`); this.name = 'AmbiguousPathError'; this.path = path; this.candidates = candidates; } }