JSONParseError.as 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. Copyright (c) 2008, Adobe Systems Incorporated
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. * Redistributions of source code must retain the above copyright notice,
  8. this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. * Neither the name of Adobe Systems Incorporated nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  16. IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  17. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  18. PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  19. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  20. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  22. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. package com.adobe.serialization.json {
  28. /**
  29. *
  30. *
  31. */
  32. public class JSONParseError extends Error {
  33. /** The location in the string where the error occurred */
  34. private var _location:int;
  35. /** The string in which the parse error occurred */
  36. private var _text:String;
  37. /**
  38. * Constructs a new JSONParseError.
  39. *
  40. * @param message The error message that occurred during parsing
  41. * @langversion ActionScript 3.0
  42. * @playerversion Flash 9.0
  43. * @tiptext
  44. */
  45. public function JSONParseError( message:String = "", location:int = 0, text:String = "") {
  46. super( message );
  47. name = "JSONParseError";
  48. _location = location;
  49. _text = text;
  50. }
  51. /**
  52. * Provides read-only access to the location variable.
  53. *
  54. * @return The location in the string where the error occurred
  55. * @langversion ActionScript 3.0
  56. * @playerversion Flash 9.0
  57. * @tiptext
  58. */
  59. public function get location():int {
  60. return _location;
  61. }
  62. /**
  63. * Provides read-only access to the text variable.
  64. *
  65. * @return The string in which the error occurred
  66. * @langversion ActionScript 3.0
  67. * @playerversion Flash 9.0
  68. * @tiptext
  69. */
  70. public function get text():String {
  71. return _text;
  72. }
  73. }
  74. }