definitions.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. /**
  20. * Error that should be used when
  21. * not null type required
  22. *
  23. * @param message
  24. * @constructor
  25. */
  26. App.NotNullTypeError = function(message) {
  27. this.name = "NotNullTypeError";
  28. this.message = "Not null expected. " + (message || "");
  29. };
  30. App.NotNullTypeError.prototype = new TypeError();
  31. /**
  32. * Error that should be used when
  33. * object required
  34. *
  35. * @param message
  36. * @constructor
  37. */
  38. App.ObjectTypeError = function(message) {
  39. this.name = "ObjectTypeError";
  40. this.message = "Object expected. " + (message || "");
  41. };
  42. App.ObjectTypeError.prototype = new App.NotNullTypeError();
  43. /**
  44. * Error that should be used when
  45. * array required
  46. *
  47. * @param message
  48. * @constructor
  49. */
  50. App.ArrayTypeError = function(message) {
  51. this.name = "ArrayTypeError";
  52. this.message = "Array expected. " + (message || "");
  53. };
  54. App.ArrayTypeError.prototype = new App.NotNullTypeError();
  55. /**
  56. * Error that should be used when
  57. * function required
  58. *
  59. * @param message
  60. * @constructor
  61. */
  62. App.FunctionTypeError = function(message) {
  63. this.name = "FunctionTypeError";
  64. this.message = "Function expected. " + (message || "");
  65. };
  66. App.FunctionTypeError.prototype = new App.NotNullTypeError();
  67. /**
  68. * Error that should be used when
  69. * ember object required
  70. *
  71. * @param message
  72. * @constructor
  73. */
  74. App.EmberObjectTypeError = function(message) {
  75. this.name = "EmberObjectTypeError";
  76. this.message = "Ember object expected. " + (message || "");
  77. };
  78. App.EmberObjectTypeError.prototype = new App.ObjectTypeError();