|
42 | 42 | import io.a2a.spec.A2AError; |
43 | 43 | import io.a2a.spec.AgentCard; |
44 | 44 | import io.a2a.spec.CancelTaskParams; |
45 | | -import io.a2a.spec.ContentTypeNotSupportedError; |
46 | 45 | import io.a2a.spec.ExtendedAgentCardNotConfiguredError; |
47 | 46 | import io.a2a.spec.DeleteTaskPushNotificationConfigParams; |
48 | 47 | import io.a2a.spec.EventKind; |
49 | | -import io.a2a.spec.ExtensionSupportRequiredError; |
50 | 48 | import io.a2a.spec.GetTaskPushNotificationConfigParams; |
51 | 49 | import io.a2a.spec.InternalError; |
52 | | -import io.a2a.spec.InvalidAgentResponseError; |
53 | 50 | import io.a2a.spec.InvalidParamsError; |
54 | 51 | import io.a2a.spec.InvalidRequestError; |
55 | 52 | import io.a2a.spec.JSONParseError; |
56 | 53 | import io.a2a.spec.ListTaskPushNotificationConfigsParams; |
57 | 54 | import io.a2a.spec.ListTaskPushNotificationConfigsResult; |
58 | 55 | import io.a2a.spec.ListTasksParams; |
59 | | -import io.a2a.spec.MethodNotFoundError; |
60 | 56 | import io.a2a.spec.PushNotificationNotSupportedError; |
61 | 57 | import io.a2a.spec.StreamingEventKind; |
62 | 58 | import io.a2a.spec.Task; |
63 | 59 | import io.a2a.spec.TaskIdParams; |
64 | | -import io.a2a.spec.TaskNotCancelableError; |
65 | 60 | import io.a2a.spec.TaskNotFoundError; |
66 | 61 | import io.a2a.spec.TaskPushNotificationConfig; |
67 | 62 | import io.a2a.spec.TaskQueryParams; |
68 | 63 | import io.a2a.spec.TaskState; |
69 | 64 | import io.a2a.spec.UnsupportedOperationError; |
70 | | -import io.a2a.spec.VersionNotSupportedError; |
71 | 65 | import mutiny.zero.ZeroPublisher; |
72 | 66 | import org.jspecify.annotations.Nullable; |
73 | 67 |
|
@@ -763,34 +757,7 @@ private static int mapErrorToHttpStatus(A2AError error) { |
763 | 757 | if (errorCode != null) { |
764 | 758 | return errorCode.httpCode(); |
765 | 759 | } |
766 | | - if (error instanceof InvalidParamsError) { |
767 | | - return 422; |
768 | | - } |
769 | | - if (error instanceof MethodNotFoundError || error instanceof TaskNotFoundError) { |
770 | | - return 404; |
771 | | - } |
772 | | - if (error instanceof TaskNotCancelableError) { |
773 | | - return 409; |
774 | | - } |
775 | | - if (error instanceof UnsupportedOperationError) { |
776 | | - return 501; |
777 | | - } |
778 | | - if (error instanceof ContentTypeNotSupportedError) { |
779 | | - return 415; |
780 | | - } |
781 | | - if (error instanceof InvalidAgentResponseError) { |
782 | | - return 502; |
783 | | - } |
784 | | - if (error instanceof ExtendedAgentCardNotConfiguredError |
785 | | - || error instanceof ExtensionSupportRequiredError |
786 | | - || error instanceof VersionNotSupportedError |
787 | | - || error instanceof PushNotificationNotSupportedError) { |
788 | | - return 400; |
789 | | - } |
790 | | - if (error instanceof InternalError) { |
791 | | - return 500; |
792 | | - } |
793 | | - return 500; |
| 760 | + return A2AErrorCodes.INTERNAL.httpCode(); |
794 | 761 | } |
795 | 762 |
|
796 | 763 | /** |
|
0 commit comments