/source/dialogs/Error.js
JavaScript | 61 lines | 40 code | 1 blank | 20 comment | 0 complexity | 28df6d97f314ef95411fe3a15e1399ce MD5 | raw file
Possible License(s): Apache-2.0
- /**
- * Error Dialog
- * ~~~~~~~~~~~~
- * Project: Pinnned
- * Author: Aaron Toth
- *
- * Copyright 2011 Aaron Toth
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- enyo.kind({
- name: "me.aaront.Error",
- kind: enyo.ModalDialog,
- caption: $L("Error"),
- lazy: false,
- width: "400px",
- events: {
- onClose: "",
- onReport: ""
- },
- components: [
- {name: "errorContent", className: "enyo-text-error warning-icon"},
- {kind: "HFlexBox", flex: 1, components: [
- {name: "reportButton", kind: "Button", flex: 1, caption: $L("Report problem..."), onclick: "reportProblem"},
- {name: "okButton", kind: "Button", flex: 1, caption: $L("OK"), onclick: "closePopup", className: "enyo-button-negative"}
- ]}
- ],
- errorParser: {
- 400: $L("The request is invalid and cannot be processed"),
- 401: $L("Your account login seems to be incorrect"),
- 404: $L("What you're looking for wasn't found"),
- 500: $L("An unexpected server error occurred"),
- 501: $L("The request is invalid and cannot be processed"),
- 999: $L("Sorry, unable to process your request at this time. Wait a while and try again")
- },
- create: function() {
- this.inherited(arguments);
- },
- gotError: function(errorNumber, errorText) {
- this.$.errorContent.setContent(this.errorParser.hasOwnProperty(errorNumber) ? this.errorParser[errorNumber] : $L("Error") + " " + errorNumber.toString() + ": " +errorText);
- },
- closePopup: function(inSender) {
- this.doClose();
- this.close();
- },
- reportProblem: function(inSender) {
- this.closePopup(inSender);
- this.doReport();
- }
- });