Skip to content

Commit 67bdabd

Browse files
Stephan202amuramoto
authored andcommitted
Add custom MAX_WAYPOINTS_EXCEEDED exception (#640)
1 parent 47acc92 commit 67bdabd

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ Pavel Smagin <smaginp@gmail.com> @psmagin
2222
Romain Sertelon <romain@sertelon.fr> @rsertelon
2323
Sam Lukes <sam_lukes@icloud.com> @slukes
2424
Sipos Tamas <sipos.tamas@fhb.hu> @onlyonce
25+
Stephan Schroevers <stephan.schroevers@teampicnic.com> @Stephan202

src/main/java/com/google/maps/errors/ApiException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public static ApiException from(String status, String errorMessage) {
4444
return new MaxElementsExceededException(errorMessage);
4545
} else if ("MAX_ROUTE_LENGTH_EXCEEDED".equals(status)) {
4646
return new MaxRouteLengthExceededException(errorMessage);
47+
} else if ("MAX_WAYPOINTS_EXCEEDED".equals(status)) {
48+
return new MaxWaypointsExceededException(errorMessage);
4749
} else if ("NOT_FOUND".equals(status)) {
4850
return new NotFoundException(errorMessage);
4951
} else if ("OVER_QUERY_LIMIT".equals(status)) {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2019 Google Inc. All rights reserved.
3+
*
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6+
* file except in compliance with the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under
11+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12+
* ANY KIND, either express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package com.google.maps.errors;
17+
18+
/**
19+
* Indicates that too many waypoints were provided in the request.
20+
*
21+
* @see <a href="https://developers.google.com/maps/documentation/directions/intro#StatusCodes">
22+
* Status Codes</a>
23+
*/
24+
public class MaxWaypointsExceededException extends ApiException {
25+
private static final long serialVersionUID = 1L;
26+
27+
public MaxWaypointsExceededException(String errorMessage) {
28+
super(errorMessage);
29+
}
30+
}

0 commit comments

Comments
 (0)