Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OTSWithFeign
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siva Naga Someswara Jatla
OTSWithFeign
Commits
9542f52b
Commit
9542f52b
authored
May 06, 2020
by
sgandhi@nisum.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EPE-006 : Added ccustomw exception
parent
b8782293
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
7 deletions
+31
-7
build.gradle
build.gradle
+1
-1
FeignExceptionHandler.java
...ffertransactionservice/handler/FeignExceptionHandler.java
+5
-5
CustomCreatedCustomException.java
...nsactionservice/service/CustomCreatedCustomException.java
+16
-0
OfferCallingPEService.java
...ffertransactionservice/service/OfferCallingPEService.java
+9
-1
No files found.
build.gradle
View file @
9542f52b
...
...
@@ -19,7 +19,7 @@ configurations {
repositories
{
flatDir
{
dirs
'
C:\\Users\\abogari\\.m2\\repository\\com\\nisum\\exceptionservice\\
0.0.1'
dirs
'
/Users/sivanagasomeswaragandhijatla/.m2/repository/com/nisum/exceptionservice/
0.0.1'
// dirs '/Users/sivanagagasomeswaragandhijatla/.m2/repository/com/nisum/exceptionservice/0.0.1'
}
mavenCentral
()
...
...
src/main/java/com/nisum/offertransactionservice/handler/FeignExceptionHandler.java
View file @
9542f52b
package
com
.
nisum
.
offertransactionservice
.
handler
;
import
feign.Feign
Exception
;
import
com.nisum.offertransactionservice.service.CustomCreatedCustom
Exception
;
import
org.json.JSONObject
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
...
...
@@ -11,9 +11,9 @@ import java.util.Map;
@RestControllerAdvice
public
class
FeignExceptionHandler
{
@ExceptionHandler
({
FeignException
.
BadRequest
.
class
,
FeignException
.
InternalServerError
.
class
,
FeignException
.
NotFound
.
class
})
public
Map
<
String
,
Object
>
handleFeignStatusException
(
Feign
Exception
e
,
HttpServletResponse
response
)
{
response
.
setStatus
(
e
.
s
tatus
());
return
new
JSONObject
(
e
.
c
ontentUTF8
()).
toMap
();
@ExceptionHandler
({
CustomCreatedCustomException
.
class
})
public
Map
<
String
,
Object
>
handleFeignStatusException
(
CustomCreatedCustom
Exception
e
,
HttpServletResponse
response
)
{
response
.
setStatus
(
e
.
getS
tatus
());
return
new
JSONObject
(
e
.
getC
ontentUTF8
()).
toMap
();
}
}
src/main/java/com/nisum/offertransactionservice/service/CustomCreatedCustomException.java
0 → 100644
View file @
9542f52b
package
com
.
nisum
.
offertransactionservice
.
service
;
import
feign.FeignException
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
CustomCreatedCustomException
extends
RuntimeException
{
private
int
status
;
private
String
contentUTF8
;
}
src/main/java/com/nisum/offertransactionservice/service/OfferCallingPEService.java
View file @
9542f52b
...
...
@@ -9,6 +9,7 @@ import com.nisum.offertransactionservice.dao.OfferMetaDataRepo;
import
com.nisum.offertransactionservice.dto.*
;
import
com.nisum.offertransactionservice.genericexception.GlobalApiGenericException
;
import
com.nisum.offertransactionservice.model.*
;
import
feign.FeignException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.mapstruct.factory.Mappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -53,8 +54,15 @@ public class OfferCallingPEService {
OfferTransactionResponse
offerTransactionResponse
;
PERequest
peRequest
=
INSTANCE
.
map
(
offerTransactionRequest
);
peRequest
.
setEligibleOffers
(
offerLookupDTOList
);
peRequest
.
setHhId
(
null
);
log
.
info
(
"Promotional Engine Feign client call Start"
);
ResponseEntity
<
PEResponse
>
peResponse
=
feignClientService
.
callPEService
(
peRequest
);
ResponseEntity
<
PEResponse
>
peResponse
=
null
;
try
{
peResponse
=
feignClientService
.
callPEService
(
peRequest
);
}
catch
(
FeignException
e
){
throw
new
CustomCreatedCustomException
(
e
.
status
(),
e
.
contentUTF8
());
}
log
.
debug
(
"Promotional Engine Feign client call End"
);
offerTransactionResponse
=
INSTANCE
.
map
(
peResponse
.
getBody
());
offerTransactionResponse
.
setTransactionId
(
offerTransactionRequest
.
getTransactionId
());
...
...
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