-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from bilthon/master
Added some more information about errors on the onRoutingFailure
- Loading branch information
Showing
7 changed files
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
|
||
//. by Haseem Saheed | ||
public interface Parser { | ||
List<Route> parse(); | ||
List<Route> parse() throws RouteException; | ||
} |
45 changes: 45 additions & 0 deletions
45
library/src/main/java/com/directions/route/RouteException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.directions.route; | ||
|
||
import android.util.Log; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
/** | ||
* Created by nelson on 1/13/16. | ||
*/ | ||
public class RouteException extends Exception { | ||
private static final String TAG = "RouteException"; | ||
private final String KEY_STATUS = "status"; | ||
private final String KEY_MESSAGE = "error_message"; | ||
|
||
private String statusCode; | ||
private String message; | ||
|
||
public RouteException(JSONObject json){ | ||
if(json == null){ | ||
statusCode = ""; | ||
message = "Parsing error"; | ||
return; | ||
} | ||
try { | ||
statusCode = json.getString(KEY_STATUS); | ||
message = json.getString(KEY_MESSAGE); | ||
} catch (JSONException e) { | ||
Log.e(TAG, "JSONException while parsing RouteException argument. Msg: " + e.getMessage()); | ||
} | ||
} | ||
|
||
public RouteException(String msg){ | ||
message = msg; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public String getStatusCode() { | ||
return statusCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters