// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/GetGeoLocationException.java
// public class GetGeoLocationException extends Exception {
//     public GetGeoLocationException(final String message, final Throwable throwable) {
//         super(message, throwable);
//     }
// 
//     public GetGeoLocationException(final String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
// 
//     public InvalidParametersException(final String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/GeoLocationNotFoundException.java
// public class GeoLocationNotFoundException extends Exception{
// 
//     public GeoLocationNotFoundException(final String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/PathNotFoundException.java
// public class PathNotFoundException extends Exception {
// 
//     public PathNotFoundException(final String message) {
//         super(message);
//     }
// }


import org.learning.by.example.reactive.microservices.exceptions.GetGeoLocationException;
import org.learning.by.example.reactive.microservices.exceptions.InvalidParametersException;
import org.learning.by.example.reactive.microservices.exceptions.GeoLocationNotFoundException;
import org.learning.by.example.reactive.microservices.exceptions.PathNotFoundException;
import org.springframework.http.HttpStatus;
import reactor.core.publisher.Mono;
package org.learning.by.example.reactive.microservices.handlers;


class ThrowableTranslator {

    private final HttpStatus httpStatus;
    private final String message;

    private ThrowableTranslator(final Throwable throwable) {
        this.httpStatus = getStatus(throwable);
        this.message = throwable.getMessage();
    }

    private HttpStatus getStatus(final Throwable error) {
        if (error instanceof InvalidParametersException) {
            return HttpStatus.BAD_REQUEST;
        } else if (error instanceof PathNotFoundException) {
            return HttpStatus.NOT_FOUND;
        } else if (error instanceof GeoLocationNotFoundException) {
            return HttpStatus.NOT_FOUND;
        } else if (error instanceof GetGeoLocationException) {
// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/GetGeoLocationException.java
// public class GetGeoLocationException extends Exception {
//     public GetGeoLocationException(final String message, final Throwable throwable) {
//         super(message, throwable);
//     }
// 
//     public GetGeoLocationException(final String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
// 
//     public InvalidParametersException(final String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/GeoLocationNotFoundException.java
// public class GeoLocationNotFoundException extends Exception{
// 
//     public GeoLocationNotFoundException(final String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/org/learning/by/example/reactive/microservices/exceptions/PathNotFoundException.java
// public class PathNotFoundException extends Exception {
// 
//     public PathNotFoundException(final String message) {
//         super(message);
//     }
// }


// Path: src/main/java/org/learning/by/example/reactive/microservices/handlers/ThrowableTranslator.java
import org.learning.by.example.reactive.microservices.exceptions.GetGeoLocationException;
import org.learning.by.example.reactive.microservices.exceptions.InvalidParametersException;
import org.learning.by.example.reactive.microservices.exceptions.GeoLocationNotFoundException;
import org.learning.by.example.reactive.microservices.exceptions.PathNotFoundException;
import org.springframework.http.HttpStatus;
import reactor.core.publisher.Mono;

package org.learning.by.example.reactive.microservices.handlers;


class ThrowableTranslator {

    private final HttpStatus httpStatus;
    private final String message;

    private ThrowableTranslator(final Throwable throwable) {
        this.httpStatus = getStatus(throwable);
        this.message = throwable.getMessage();
    }

    private HttpStatus getStatus(final Throwable error) {
        if (error instanceof InvalidParametersException) {
            return HttpStatus.BAD_REQUEST;
        } else if (error instanceof PathNotFoundException) {
            return HttpStatus.NOT_FOUND;
        } else if (error instanceof GeoLocationNotFoundException) {
            return HttpStatus.NOT_FOUND;
        } else if (error instanceof GetGeoLocationException) {
            if (error.getCause() instanceof InvalidParametersException)