diff options
Diffstat (limited to '')
| -rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java | 4 | ||||
| -rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.ts | 3 | 
2 files changed, 5 insertions, 2 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java index 9592490..6356fd9 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java @@ -17,10 +17,10 @@ import org.springframework.web.bind.annotation.RequestMapping;  import org.springframework.web.bind.annotation.RequestParam;  import org.springframework.web.bind.annotation.RestController; +import com.ufund.api.ufundapi.DuplicateKeyException;  import com.ufund.api.ufundapi.model.Need;  import com.ufund.api.ufundapi.model.Need.GoalType;  import com.ufund.api.ufundapi.service.CupboardService; -import com.ufund.api.ufundapi.DuplicateKeyException;  @RestController  @RequestMapping("cupboard") @@ -59,7 +59,7 @@ public class CupboardController {          } catch (DuplicateKeyException ex) {              return new ResponseEntity<>(HttpStatus.CONFLICT);          } catch (IllegalArgumentException ex) { -            return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY); +            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);          } catch (IOException ex) {              return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);          } diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index 45346b4..13eddad 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -106,6 +106,7 @@ export class CupboardComponent implements OnInit {          console.log(need.id, need, "need updated");          this.cupboardService.updateNeed(need.id, need)              .pipe(catchError((ex, r) => { +                console.log(ex.status);                  if (ex.status == 500) {                      this.statusText.next("Fields cannot be blank");                  } else if (ex.status == 400) { @@ -141,6 +142,7 @@ export class CupboardComponent implements OnInit {          console.log("form submitted. creating need: ", need);          this.cupboardService.createNeed(need)              .pipe(catchError((ex, r) => { +                console.log(ex.status);                  if (ex.status == 500) {                      this.statusText.next("Fields cannot be blank");                  } else if (ex.status == 400) { @@ -203,6 +205,7 @@ let friendlyHttpStatus: { [key: number]: string } = {      416: 'Requested Range Not Satisfiable',      417: 'Expectation Failed',      418: 'I\'m a teapot', +    422: 'Unprocessable Entity',      429: 'Too Many Requests',      500: 'Internal Server Error',      501: 'Not Implemented',  | 
