// Path: src/main/java/com/mpalourdio/springboottemplate/exception/CustomException.java
// @ResponseStatus(code = HttpStatus.PAYLOAD_TOO_LARGE)
// public class CustomException extends Exception {
// 
//     public CustomException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/exception/ResponseObject.java
// public class ResponseObject {
// 
//     public String property;
// 
//     public ResponseObject() {
// 
//     }
// }


import com.mpalourdio.springboottemplate.exception.CustomException;
import com.mpalourdio.springboottemplate.exception.ResponseObject;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
package com.mpalourdio.springboottemplate.controllers;


@RestController
@RequestMapping("/exception")
public class ExceptionController {

    @GetMapping(value = "nok", produces = MediaType.APPLICATION_JSON_VALUE)
    public String throwException() throws CustomException {
        if (1 == 1) {
            throw new CustomException("bad");
        }

// Path: src/main/java/com/mpalourdio/springboottemplate/exception/CustomException.java
// @ResponseStatus(code = HttpStatus.PAYLOAD_TOO_LARGE)
// public class CustomException extends Exception {
// 
//     public CustomException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/exception/ResponseObject.java
// public class ResponseObject {
// 
//     public String property;
// 
//     public ResponseObject() {
// 
//     }
// }


// Path: src/main/java/com/mpalourdio/springboottemplate/controllers/ExceptionController.java
import com.mpalourdio.springboottemplate.exception.CustomException;
import com.mpalourdio.springboottemplate.exception.ResponseObject;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;

package com.mpalourdio.springboottemplate.controllers;


@RestController
@RequestMapping("/exception")
public class ExceptionController {

    @GetMapping(value = "nok", produces = MediaType.APPLICATION_JSON_VALUE)
    public String throwException() throws CustomException {
        if (1 == 1) {
            throw new CustomException("bad");
        }

        return "all is ok if here";