source: code/Website/open-flash-chart/JsonErrorMsg.as@ 7878

Last change on this file since 7878 was 7849, checked in by dennisw, 15 years ago
File size: 710 bytes
Line 
1package {
2
3 public class JsonErrorMsg extends ErrorMsg {
4
5 public function JsonErrorMsg( json:String, e:Error ):void {
6
7 var tmp:String = "Open Flash Chart\n\n";
8 tmp += "JSON Parse Error ["+ e.message +"]\n";
9
10 // find the end of line after the error location:
11 var pos:Number = json.indexOf( "\n", e.errorID );
12 var s:String = json.substr(0, pos);
13 var lines:Array = s.split("\n");
14
15 tmp += "Error at character " + e.errorID + ", line " + lines.length +":\n\n";
16
17 for ( var i:Number = 3; i > 0; i-- ) {
18 if( lines.length-i > -1 )
19 tmp += (lines.length - i).toString() +": " + lines[lines.length - i];
20
21 }
22
23 super( tmp );
24 }
25 }
26}
Note: See TracBrowser for help on using the repository browser.