|
34 | 34 | ) |
35 | 35 |
|
36 | 36 |
|
37 | | -def to_desc(exceptions: set[type[Exception]] | type[Exception]): |
38 | | - exc_classes = {exceptions} if not isinstance(exceptions, set) else exceptions |
| 37 | +def to_desc(exceptions: list[type[Exception]] | type[Exception]): |
| 38 | + exc_classes = [exceptions] if not isinstance(exceptions, list) else exceptions |
39 | 39 | return ", ".join(f"{cls.__name__}" for cls in exc_classes) |
40 | 40 |
|
41 | 41 |
|
42 | 42 | @router.post( |
43 | 43 | "/projects/{project_id}:open", |
44 | 44 | response_model=Envelope[ProjectGet], |
45 | 45 | responses={ |
46 | | - status.HTTP_400_BAD_REQUEST: {"description": to_desc({ValidationError})}, |
| 46 | + status.HTTP_400_BAD_REQUEST: {"description": to_desc([ValidationError])}, |
47 | 47 | status.HTTP_402_PAYMENT_REQUIRED: { |
48 | | - "description": to_desc({WalletNotEnoughCreditsError}) |
| 48 | + "description": to_desc([WalletNotEnoughCreditsError]) |
49 | 49 | }, |
50 | 50 | status.HTTP_403_FORBIDDEN: { |
51 | | - "description": to_desc({ProjectInvalidRightsError}) |
| 51 | + "description": to_desc([ProjectInvalidRightsError]) |
52 | 52 | }, |
53 | 53 | status.HTTP_404_NOT_FOUND: { |
54 | 54 | "description": to_desc( |
55 | | - {ProjectNotFoundError, UserDefaultWalletNotFoundError} |
| 55 | + [ProjectNotFoundError, UserDefaultWalletNotFoundError] |
56 | 56 | ) |
57 | 57 | }, |
58 | 58 | status.HTTP_409_CONFLICT: { |
59 | | - "description": to_desc({ProjectTooManyProjectOpenedError}), |
| 59 | + "description": to_desc([ProjectTooManyProjectOpenedError]), |
60 | 60 | }, |
61 | 61 | status.HTTP_422_UNPROCESSABLE_ENTITY: { |
62 | | - "description": to_desc({ValidationError}) |
| 62 | + "description": to_desc([ValidationError]) |
63 | 63 | }, |
64 | 64 | status.HTTP_503_SERVICE_UNAVAILABLE: { |
65 | | - "description": to_desc({DirectorServiceError}) |
| 65 | + "description": to_desc([DirectorServiceError]) |
66 | 66 | }, |
67 | 67 | }, |
68 | 68 | ) |
|
0 commit comments