Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Situation_center
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Куаныш
Situation_center
Commits
7c689762
You need to sign in or sign up before continuing.
Commit
7c689762
authored
Mar 11, 2021
by
Khazretsultan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nce integration
parents
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
0 deletions
+72
-0
ApiException.java
.../java/nce/integration/synergy/exception/ApiException.java
+21
-0
ApiExceptionHandler.java
...ce/integration/synergy/exception/ApiExceptionHandler.java
+27
-0
ApiRequestException.java
...ce/integration/synergy/exception/ApiRequestException.java
+10
-0
SampleException.java
...va/nce/integration/synergy/exception/SampleException.java
+14
-0
No files found.
src/main/java/nce/integration/synergy/exception/ApiException.java
0 → 100644
View file @
7c689762
package
kz
.
neos
.
arc
.
exception
;
import
lombok.Data
;
import
org.springframework.http.HttpStatus
;
import
java.time.ZonedDateTime
;
@Data
public
class
ApiException
{
private
final
String
message
;
private
final
HttpStatus
httpStatus
;
private
final
ZonedDateTime
zonedDateTime
;
public
ApiException
(
String
message
,
Throwable
throwable
,
HttpStatus
httpStatus
,
ZonedDateTime
zonedDateTime
)
{
this
.
message
=
message
;
this
.
httpStatus
=
httpStatus
;
this
.
zonedDateTime
=
zonedDateTime
;
}
}
src/main/java/nce/integration/synergy/exception/ApiExceptionHandler.java
0 → 100644
View file @
7c689762
package
kz
.
neos
.
arc
.
exception
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
@ControllerAdvice
public
class
ApiExceptionHandler
{
@ExceptionHandler
(
value
=
{
ApiRequestException
.
class
})
public
ResponseEntity
<?>
handlerApiRequestException
(
ApiRequestException
e
)
{
HttpStatus
badRequest
=
HttpStatus
.
BAD_REQUEST
;
ApiException
apiException
=
new
ApiException
(
e
.
getMessage
(),
e
,
HttpStatus
.
BAD_REQUEST
,
ZonedDateTime
.
now
(
ZoneId
.
of
(
"Z"
))
);
return
new
ResponseEntity
<>(
apiException
,
badRequest
);
}
}
src/main/java/nce/integration/synergy/exception/ApiRequestException.java
0 → 100644
View file @
7c689762
package
kz
.
neos
.
arc
.
exception
;
public
class
ApiRequestException
extends
RuntimeException
{
public
ApiRequestException
(
String
message
)
{
super
(
message
);
}
public
ApiRequestException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
}
src/main/java/nce/integration/synergy/exception/SampleException.java
0 → 100644
View file @
7c689762
package
kz
.
neos
.
arc
.
exception
;
/**
* Author: Khazretsultan Zhiyentayev
* Date: 01.03.2021
* Time: 21:47
* e-mail: zhiyentayev.khazretsultan@gmail.com
*/
public
class
SampleException
extends
RuntimeException
{
public
SampleException
(
String
message
)
{
super
(
message
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment