Skip to content

Commit

Permalink
feat: Add NoRemoteRepositoryException handling
Browse files Browse the repository at this point in the history
  • Loading branch information
npole0103 committed Oct 17, 2022
1 parent 841164c commit 1ce1684
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kr.markdown.alreadyme.controller;

import org.eclipse.jgit.errors.NoRemoteRepositoryException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
Expand All @@ -19,4 +20,13 @@ public ResponseEntity<?> badRequestHandler(MethodArgumentNotValidException e) {
error.put("message", "This github URL is invalid");
return ResponseEntity.badRequest().body(error);
}

@ExceptionHandler({NoRemoteRepositoryException.class})
public ResponseEntity<?> badRequestHandler(NoRemoteRepositoryException e) {
Map<String, Object> error = new HashMap<>();
error.put("timestamp", new Date());
error.put("code", "400");
error.put("message", "Error occured while cloning the repository. Check your github url.");
return ResponseEntity.badRequest().body(error);
}
}

0 comments on commit 1ce1684

Please sign in to comment.