abp icon indicating copy to clipboard operation
abp copied to clipboard

How to change the validate code by myself?

Open wingqing1314 opened this issue 6 years ago • 6 comments

image I want to custom return code ,like the loction of the pic above. By the way, Can I change the whole json format to what I want ?In other words, I want to change the json format of exception.

wingqing1314 avatar May 16 '20 07:05 wingqing1314

See https://docs.abp.io/en/abp/latest/Exception-Handling

You can customize exception filter to return your json format : https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs

realLiangshiwei avatar May 16 '20 07:05 realLiangshiwei

So i must change the source code?

wingqing1314 avatar May 19 '20 10:05 wingqing1314

See https://docs.abp.io/en/abp/latest/Exception-Handling

You can customize exception filter to return your json format : https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs

So i must change the source code?

wingqing1314 avatar May 19 '20 10:05 wingqing1314

Yes.

realLiangshiwei avatar May 19 '20 11:05 realLiangshiwei

image I want to custom return code ,like the loction of the pic above. By the way, Can I change the whole json format to what I want ?In other words, I want to change the json format of exception.

How were you able to get it to return a validation exception? I threw a validation exception but all I got on the swagger was a status code 500 { "error": { "code": null, "message": "An internal error occurred during your request!", "details": null, "validationErrors": null } }

ZouZou avatar May 22 '20 07:05 ZouZou

hi @ZouZou

Please create a new issue separately and explain it in detail, thanks.

maliming avatar May 22 '20 07:05 maliming