comparison Core/Enumerations.cpp @ 1576:de54c19fc44d

refactoring OrthancException
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 14:48:06 +0200
parents f8aae45011c9
children 7aac0cddd42e
comparison
equal deleted inserted replaced
1575:f8aae45011c9 1576:de54c19fc44d
917 917
918 default: 918 default:
919 throw OrthancException(ErrorCode_ParameterOutOfRange); 919 throw OrthancException(ErrorCode_ParameterOutOfRange);
920 } 920 }
921 } 921 }
922
923
924 HttpStatus ConvertErrorCodeToHttpStatus(ErrorCode error)
925 {
926 switch (error)
927 {
928 case ErrorCode_Success:
929 {
930 return HttpStatus_200_Ok;
931 }
932
933 case ErrorCode_InexistentFile:
934 case ErrorCode_InexistentItem:
935 case ErrorCode_InexistentTag:
936 case ErrorCode_UnknownResource:
937 {
938 return HttpStatus_404_NotFound;
939 }
940
941 case ErrorCode_BadFileFormat:
942 case ErrorCode_BadParameterType:
943 case ErrorCode_BadRequest:
944 case ErrorCode_ParameterOutOfRange:
945 case ErrorCode_UriSyntax:
946 {
947 return HttpStatus_400_BadRequest;
948 break;
949 }
950
951 default:
952 {
953 return HttpStatus_500_InternalServerError;
954 }
955 }
956 }
922 } 957 }