PageRenderTime 53ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/source/dialogs/Error.js

https://bitbucket.org/aaront/pinnned
JavaScript | 61 lines | 40 code | 1 blank | 20 comment | 0 complexity | 28df6d97f314ef95411fe3a15e1399ce MD5 | raw file
Possible License(s): Apache-2.0
  1. /**
  2. * Error Dialog
  3. * ~~~~~~~~~~~~
  4. * Project: Pinnned
  5. * Author: Aaron Toth
  6. *
  7. * Copyright 2011 Aaron Toth
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License");
  10. * you may not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS,
  17. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. */
  21. enyo.kind({
  22. name: "me.aaront.Error",
  23. kind: enyo.ModalDialog,
  24. caption: $L("Error"),
  25. lazy: false,
  26. width: "400px",
  27. events: {
  28. onClose: "",
  29. onReport: ""
  30. },
  31. components: [
  32. {name: "errorContent", className: "enyo-text-error warning-icon"},
  33. {kind: "HFlexBox", flex: 1, components: [
  34. {name: "reportButton", kind: "Button", flex: 1, caption: $L("Report problem..."), onclick: "reportProblem"},
  35. {name: "okButton", kind: "Button", flex: 1, caption: $L("OK"), onclick: "closePopup", className: "enyo-button-negative"}
  36. ]}
  37. ],
  38. errorParser: {
  39. 400: $L("The request is invalid and cannot be processed"),
  40. 401: $L("Your account login seems to be incorrect"),
  41. 404: $L("What you're looking for wasn't found"),
  42. 500: $L("An unexpected server error occurred"),
  43. 501: $L("The request is invalid and cannot be processed"),
  44. 999: $L("Sorry, unable to process your request at this time. Wait a while and try again")
  45. },
  46. create: function() {
  47. this.inherited(arguments);
  48. },
  49. gotError: function(errorNumber, errorText) {
  50. this.$.errorContent.setContent(this.errorParser.hasOwnProperty(errorNumber) ? this.errorParser[errorNumber] : $L("Error") + " " + errorNumber.toString() + ": " +errorText);
  51. },
  52. closePopup: function(inSender) {
  53. this.doClose();
  54. this.close();
  55. },
  56. reportProblem: function(inSender) {
  57. this.closePopup(inSender);
  58. this.doReport();
  59. }
  60. });