SlideShare a Scribd company logo
Exception Mapping
using APIKit
Federico Amdan
What is the exception mapping?
- If you are creating an API using Mule, there will be times
when you have to throw an exception. If you want to
provide a better comment of what is going on inside of
your code, you should explain it in a REST way, using an
status code, a response comment and the content type of
it. This is when the exception mapping comes handy.
Structure
Each exception mapping is declared with the following
attributes:
Status code <apikit:mapping statusCode="400"> Used to indicate the status number.
Exception value: <apikit:exception value="org.mule.module.apikit.exception.BadRequestException" />
Used to indicate the exception that will call this mapping.
Content-Type: <set-property propertyName="Content-Type" value="application/json" doc:name="
Property" /> Used to indicate the content - type of the payload
Payload: <set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" doc:name="Set
Payload" /> Used to indicate the message of the error.
Auto-generated mapping
Creating your own mapping
- Determine which exception will produce the error
- The exceptions can only be declared once in the
exception mapping
- Choose the status code and message of the error.
- Optionally, you can add the content-type of the error
message.
Questions?
Thanks!!

More Related Content

What's hot (15)

PPTX
ASP.NET MVC One Step Deeper
Emad Alashi
 
PPTX
API Design choices
Daniel Rabinovich
 
PDF
Akka Presentation Schule@synyx
Florian Hopf
 
PDF
Serverless - Developers.IO 2019
Shuji Watanabe
 
PDF
AngularJS
Hiten Pratap Singh
 
PDF
Building APIs That Last for Decades - Irakli Nadareishvili, Director of API S...
CA API Management
 
PDF
Mobile phone future angular js
atanacy
 
PPTX
SPA using Rails & Backbone
Ashan Fernando
 
PDF
Angular components
Sultan Ahmed
 
PPTX
Tips and Tricks for new async web client capabilities on model driven apps
Mehdi El Amri
 
PDF
Angular routing
Sultan Ahmed
 
PPTX
Indonesia data-lake
Mif Masterz
 
PDF
iOS_Presentation
Emannuel Carvalho
 
KEY
Enter the app era with ruby on rails (rubyday)
Matteo Collina
 
PPTX
Controllers in AngularJs
K Arunkumar
 
ASP.NET MVC One Step Deeper
Emad Alashi
 
API Design choices
Daniel Rabinovich
 
Akka Presentation Schule@synyx
Florian Hopf
 
Serverless - Developers.IO 2019
Shuji Watanabe
 
Building APIs That Last for Decades - Irakli Nadareishvili, Director of API S...
CA API Management
 
Mobile phone future angular js
atanacy
 
SPA using Rails & Backbone
Ashan Fernando
 
Angular components
Sultan Ahmed
 
Tips and Tricks for new async web client capabilities on model driven apps
Mehdi El Amri
 
Angular routing
Sultan Ahmed
 
Indonesia data-lake
Mif Masterz
 
iOS_Presentation
Emannuel Carvalho
 
Enter the app era with ruby on rails (rubyday)
Matteo Collina
 
Controllers in AngularJs
K Arunkumar
 

Similar to Exception mapping using api kit (20)

PPTX
Mulesoft meetup slides mumbai_20113019_exception_handling
Manish Kumar Yadav
 
PPTX
Exception handling in Mule 4 _Virtual mule soft meetup may_2020
Om Prakash
 
PPTX
Virtual MuleSoft Meetup may_2020
Om Prakash
 
PPTX
Using jersey exception mapper
Anirban Sen Chowdhary
 
PPTX
Mule meetup Hyderabad
Sravan Lingam
 
PPTX
Global Exception Handling Custom Error Connector In MuleSoft
shyamraj55
 
PPT
Mule exception strategies - Choice Exception Strategy
Ankush Sharma
 
PPTX
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
PPTX
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
PPTX
Delhi MuleSoft Meetup - 19 march2022
AnuragSharma900
 
PPTX
Anypoint Studio - Mule ESB Error Handling
Mani Rathnam Gudi
 
PPTX
Mule - error handling
Sindhu VL
 
PDF
Apikit in studio
fedefortin
 
PPTX
API LifeCycle Management
MuleSoft Meetups
 
PPTX
27th Hyderabad MuleSoft Meetup
MuleSoft Meetups
 
PPTX
Error handling with respect to mule
Sindhu VL
 
PPTX
Vancouver mulesoft meetup_23-july
Vikalp Bhalia
 
PDF
Exception handling
Anna Pietras
 
PDF
MuleSoft Surat Virtual Meetup#31 - Async API, Process Error, Circuit Breaker ...
Jitendra Bafna
 
PPTX
A short introduction on error handling in anypoint studio
Swapnil Sahu
 
Mulesoft meetup slides mumbai_20113019_exception_handling
Manish Kumar Yadav
 
Exception handling in Mule 4 _Virtual mule soft meetup may_2020
Om Prakash
 
Virtual MuleSoft Meetup may_2020
Om Prakash
 
Using jersey exception mapper
Anirban Sen Chowdhary
 
Mule meetup Hyderabad
Sravan Lingam
 
Global Exception Handling Custom Error Connector In MuleSoft
shyamraj55
 
Mule exception strategies - Choice Exception Strategy
Ankush Sharma
 
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
Delhi MuleSoft Meetup - 19 march2022
AnuragSharma900
 
Anypoint Studio - Mule ESB Error Handling
Mani Rathnam Gudi
 
Mule - error handling
Sindhu VL
 
Apikit in studio
fedefortin
 
API LifeCycle Management
MuleSoft Meetups
 
27th Hyderabad MuleSoft Meetup
MuleSoft Meetups
 
Error handling with respect to mule
Sindhu VL
 
Vancouver mulesoft meetup_23-july
Vikalp Bhalia
 
Exception handling
Anna Pietras
 
MuleSoft Surat Virtual Meetup#31 - Async API, Process Error, Circuit Breaker ...
Jitendra Bafna
 
A short introduction on error handling in anypoint studio
Swapnil Sahu
 
Ad

Recently uploaded (20)

PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PDF
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
PPTX
原版一样(EC Lille毕业证书)法国里尔中央理工学院毕业证补办
Taqyea
 
PDF
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPTX
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
PDF
NTPC PATRATU Summer internship report.pdf
hemant03701
 
PDF
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
PDF
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
PPTX
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PDF
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PDF
Digital water marking system project report
Kamal Acharya
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PDF
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PPTX
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
原版一样(EC Lille毕业证书)法国里尔中央理工学院毕业证补办
Taqyea
 
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
NTPC PATRATU Summer internship report.pdf
hemant03701
 
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Digital water marking system project report
Kamal Acharya
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
Ad

Exception mapping using api kit

  • 2. What is the exception mapping? - If you are creating an API using Mule, there will be times when you have to throw an exception. If you want to provide a better comment of what is going on inside of your code, you should explain it in a REST way, using an status code, a response comment and the content type of it. This is when the exception mapping comes handy.
  • 3. Structure Each exception mapping is declared with the following attributes: Status code <apikit:mapping statusCode="400"> Used to indicate the status number. Exception value: <apikit:exception value="org.mule.module.apikit.exception.BadRequestException" /> Used to indicate the exception that will call this mapping. Content-Type: <set-property propertyName="Content-Type" value="application/json" doc:name=" Property" /> Used to indicate the content - type of the payload Payload: <set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" doc:name="Set Payload" /> Used to indicate the message of the error.
  • 5. Creating your own mapping - Determine which exception will produce the error - The exceptions can only be declared once in the exception mapping - Choose the status code and message of the error. - Optionally, you can add the content-type of the error message.