-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gregor Herdmann
committed
May 3, 2017
1 parent
ad666a6
commit edfd82f
Showing
29 changed files
with
5,110 additions
and
1,661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2017 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
window.z = window.z || {}; | ||
window.z.conversation = z.conversation || {}; | ||
|
||
z.conversation.ConversationError = class ConversationError extends Error { | ||
constructor(type) { | ||
super(); | ||
|
||
this.name = this.constructor.name; | ||
this.stack = (new Error()).stack; | ||
this.type = type || z.client.ConversationError.TYPE.UNKNOWN; | ||
|
||
switch (this.type) { | ||
case z.conversation.ConversationError.TYPE.CONVERSATION_NOT_FOUND: | ||
this.message = 'Conversation not found'; | ||
break; | ||
case z.conversation.ConversationError.TYPE.DEGRADED_CONVERSATION_CANCELLATION: | ||
this.message = 'Sending to degraded conversation was canceled by user'; | ||
break; | ||
case z.conversation.ConversationError.TYPE.MESSAGE_NOT_FOUND: | ||
this.message = 'Message not found'; | ||
break; | ||
case z.conversation.ConversationError.TYPE.NO_CHANGES: | ||
this.message = 'Missing changes to message'; | ||
break; | ||
case z.conversation.ConversationError.TYPE.NO_CONVERSATION_ID: | ||
this.message = 'Conversation ID is not defined'; | ||
break; | ||
case z.conversation.ConversationError.TYPE.NOT_FOUND: | ||
this.message = 'Conversation not found'; | ||
break; | ||
case z.conversation.ConversationError.TYPE.REQUEST_FAILED: | ||
this.message = 'Conversation related backend request failed'; | ||
break; | ||
case z.conversation.ConversationError.TYPE.WRONG_USER: | ||
this.message = 'Wrong user tried to change or delete a message'; | ||
break; | ||
default: | ||
this.message = 'Unknown ConversationError'; | ||
} | ||
} | ||
|
||
static get TYPE() { | ||
return { | ||
CONVERSATION_NOT_FOUND: 'z.conversation.ConversationError.TYPE.CONVERSATION_NOT_FOUND', | ||
DEGRADED_CONVERSATION_CANCELLATION: 'z.conversation.ConversationError.TYPE.DEGRADED_CONVERSATION_CANCELLATION', | ||
MESSAGE_NOT_FOUND: 'z.conversation.ConversationError.TYPE.MESSAGE_NOT_FOUND', | ||
NO_CHANGES: 'z.conversation.ConversationError.TYPE.NO_CHANGES', | ||
NO_CONVERSATION_ID: 'z.conversation.ConversationError.TYPE.NO_CONVERSATION_ID', | ||
NOT_FOUND: 'z.conversation.ConversationError.TYPE.NOT_FOUND', | ||
REQUEST_FAILURE: 'z.conversation.ConversationError.TYPE.REQUEST_FAILURE', | ||
UNKNOWN: 'z.conversation.ConversationError.TYPE.UNKNOWN', | ||
WRONG_USER: 'z.conversation.ConversationError.TYPE.WRONG_USER', | ||
}; | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.