Mercurial > libervia-backend
annotate libervia/backend/core/exceptions.py @ 4306:94e0968987cd
plugin XEP-0033: code modernisation, improve delivery, data validation:
- Code has been rewritten using Pydantic models and `async` coroutines for data validation
and cleaner element parsing/generation.
- Delivery has been completely rewritten. It now works even if server doesn't support
multicast, and send to local multicast service first. Delivering to local multicast
service first is due to bad support of XEP-0033 in server (notably Prosody which has an
incomplete implementation), and the current impossibility to detect if a sub-domain
service handles fully multicast or only for local domains. This is a workaround to have
a good balance between backward compatilibity and use of bandwith, and to make it work
with the incoming email gateway implementation (the gateway will only deliver to
entities of its own domain).
- disco feature checking now uses `async` corountines. `host` implementation still use
Deferred return values for compatibility with legacy code.
rel 450
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 26 Sep 2024 16:12:01 +0200 |
parents | 0d7bb4df2343 |
children |
rev | line source |
---|---|
3028 | 1 #!/usr/bin/env python3 |
3137 | 2 |
258
aac82dee6091
Added a library for custom SàT Exceptions
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
4 # SàT Exceptions |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
5 # Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) |
258
aac82dee6091
Added a library for custom SàT Exceptions
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
10 # (at your option) any later version. |
258
aac82dee6091
Added a library for custom SàT Exceptions
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
15 # GNU Affero General Public License for more details. |
258
aac82dee6091
Added a library for custom SàT Exceptions
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
258
aac82dee6091
Added a library for custom SàT Exceptions
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
589
d1b4805124a1
Fix pep8 support in src/core.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
562
diff
changeset
|
20 |
258
aac82dee6091
Added a library for custom SàT Exceptions
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 class ProfileUnknownError(Exception): |
aac82dee6091
Added a library for custom SàT Exceptions
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 pass |
486
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
23 |
589
d1b4805124a1
Fix pep8 support in src/core.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
562
diff
changeset
|
24 |
486
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
25 class ProfileNotInCacheError(Exception): |
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
26 pass |
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
27 |
589
d1b4805124a1
Fix pep8 support in src/core.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
562
diff
changeset
|
28 |
639
99eee75ec1b7
core: better handling of profile_key and don't write the param file anymore
souliane <souliane@mailoo.org>
parents:
631
diff
changeset
|
29 class ProfileNotSetError(Exception): |
2495
537a4a8075f8
core (exceptions): added ClientTypeError to deal when a code should not be executed by a client or component profile.
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
30 """This error raises when no profile has been set (value @NONE@ is found, but it should have been replaced)""" |
639
99eee75ec1b7
core: better handling of profile_key and don't write the param file anymore
souliane <souliane@mailoo.org>
parents:
631
diff
changeset
|
31 |
99eee75ec1b7
core: better handling of profile_key and don't write the param file anymore
souliane <souliane@mailoo.org>
parents:
631
diff
changeset
|
32 |
1624 | 33 class ProfileConnected(Exception): |
893
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
853
diff
changeset
|
34 """This error is raised when trying to delete a connected profile.""" |
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
853
diff
changeset
|
35 |
308a96bc7c1b
core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
souliane <souliane@mailoo.org>
parents:
853
diff
changeset
|
36 |
1624 | 37 class ProfileNotConnected(Exception): |
486
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
38 pass |
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
39 |
589
d1b4805124a1
Fix pep8 support in src/core.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
562
diff
changeset
|
40 |
1624 | 41 class ProfileKeyUnknown(Exception): |
728
e07afabc4a25
plugin XEP-0050: Ad-Hoc commands first draft (answering part)
Goffi <goffi@goffi.org>
parents:
639
diff
changeset
|
42 pass |
e07afabc4a25
plugin XEP-0050: Ad-Hoc commands first draft (answering part)
Goffi <goffi@goffi.org>
parents:
639
diff
changeset
|
43 |
e07afabc4a25
plugin XEP-0050: Ad-Hoc commands first draft (answering part)
Goffi <goffi@goffi.org>
parents:
639
diff
changeset
|
44 |
2495
537a4a8075f8
core (exceptions): added ClientTypeError to deal when a code should not be executed by a client or component profile.
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
45 class ClientTypeError(Exception): |
537a4a8075f8
core (exceptions): added ClientTypeError to deal when a code should not be executed by a client or component profile.
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
46 """This code is not allowed for this type of client (i.e. component or not)""" |
537a4a8075f8
core (exceptions): added ClientTypeError to deal when a code should not be executed by a client or component profile.
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
47 |
537a4a8075f8
core (exceptions): added ClientTypeError to deal when a code should not be executed by a client or component profile.
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
48 |
486
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
49 class UnknownEntityError(Exception): |
0d9908ac775e
core: entity cache misc data management + error moved to core.exceptions in memory
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
50 pass |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
486
diff
changeset
|
51 |
589
d1b4805124a1
Fix pep8 support in src/core.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
562
diff
changeset
|
52 |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
486
diff
changeset
|
53 class UnknownGroupError(Exception): |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
486
diff
changeset
|
54 pass |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
55 |
589
d1b4805124a1
Fix pep8 support in src/core.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
562
diff
changeset
|
56 |
1535
c9ef16de3f13
core: more robust plugins loading:
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
57 class MissingModule(Exception): |
c9ef16de3f13
core: more robust plugins loading:
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
58 # Used to indicate when a plugin dependence is not found |
c9ef16de3f13
core: more robust plugins loading:
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
59 # it's nice to indicate when to find the dependence in argument string |
c9ef16de3f13
core: more robust plugins loading:
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
60 pass |
c9ef16de3f13
core: more robust plugins loading:
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
61 |
c9ef16de3f13
core: more robust plugins loading:
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
62 |
3248
5d67502bdc8c
core (exceptions): new MissingPlugin exception:
Goffi <goffi@goffi.org>
parents:
3186
diff
changeset
|
63 class MissingPlugin(Exception): |
5d67502bdc8c
core (exceptions): new MissingPlugin exception:
Goffi <goffi@goffi.org>
parents:
3186
diff
changeset
|
64 """A SàT plugin needed for a feature/method is missing""" |
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
65 |
3248
5d67502bdc8c
core (exceptions): new MissingPlugin exception:
Goffi <goffi@goffi.org>
parents:
3186
diff
changeset
|
66 pass |
5d67502bdc8c
core (exceptions): new MissingPlugin exception:
Goffi <goffi@goffi.org>
parents:
3186
diff
changeset
|
67 |
5d67502bdc8c
core (exceptions): new MissingPlugin exception:
Goffi <goffi@goffi.org>
parents:
3186
diff
changeset
|
68 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
69 class NotFound(Exception): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
501
diff
changeset
|
70 pass |
562
0bb2e0d1c878
core, plugin XEP-0054: avatar upload:
Goffi <goffi@goffi.org>
parents:
559
diff
changeset
|
71 |
589
d1b4805124a1
Fix pep8 support in src/core.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
562
diff
changeset
|
72 |
2674
60c9e163f1df
core (exceptions): new ConfigError exception
Goffi <goffi@goffi.org>
parents:
2624
diff
changeset
|
73 class ConfigError(Exception): |
60c9e163f1df
core (exceptions): new ConfigError exception
Goffi <goffi@goffi.org>
parents:
2624
diff
changeset
|
74 pass |
60c9e163f1df
core (exceptions): new ConfigError exception
Goffi <goffi@goffi.org>
parents:
2624
diff
changeset
|
75 |
60c9e163f1df
core (exceptions): new ConfigError exception
Goffi <goffi@goffi.org>
parents:
2624
diff
changeset
|
76 |
562
0bb2e0d1c878
core, plugin XEP-0054: avatar upload:
Goffi <goffi@goffi.org>
parents:
559
diff
changeset
|
77 class DataError(Exception): |
0bb2e0d1c878
core, plugin XEP-0054: avatar upload:
Goffi <goffi@goffi.org>
parents:
559
diff
changeset
|
78 pass |
627
d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
79 |
631
694f118d0cd5
plugin XEP-0055: implementation of Jabber Search
Goffi <goffi@goffi.org>
parents:
627
diff
changeset
|
80 |
3880
03761f8ba8bb
component AP gateway: raise exceptions on apGet + fix exceptions catching in apGetLocalObject:
Goffi <goffi@goffi.org>
parents:
3745
diff
changeset
|
81 class ExternalRequestError(Exception): |
03761f8ba8bb
component AP gateway: raise exceptions on apGet + fix exceptions catching in apGetLocalObject:
Goffi <goffi@goffi.org>
parents:
3745
diff
changeset
|
82 """Request to third party server failed""" |
03761f8ba8bb
component AP gateway: raise exceptions on apGet + fix exceptions catching in apGetLocalObject:
Goffi <goffi@goffi.org>
parents:
3745
diff
changeset
|
83 |
03761f8ba8bb
component AP gateway: raise exceptions on apGet + fix exceptions catching in apGetLocalObject:
Goffi <goffi@goffi.org>
parents:
3745
diff
changeset
|
84 |
751
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
85 class ConflictError(Exception): |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
86 pass |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
87 |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
88 |
1584
b57b4683dc33
plugin XEP-0065: session cleaning and timeout + log choosed candidate when using SI File Transfer
Goffi <goffi@goffi.org>
parents:
1535
diff
changeset
|
89 class TimeOutError(Exception): |
b57b4683dc33
plugin XEP-0065: session cleaning and timeout + log choosed candidate when using SI File Transfer
Goffi <goffi@goffi.org>
parents:
1535
diff
changeset
|
90 pass |
b57b4683dc33
plugin XEP-0065: session cleaning and timeout + log choosed candidate when using SI File Transfer
Goffi <goffi@goffi.org>
parents:
1535
diff
changeset
|
91 |
b57b4683dc33
plugin XEP-0065: session cleaning and timeout + log choosed candidate when using SI File Transfer
Goffi <goffi@goffi.org>
parents:
1535
diff
changeset
|
92 |
751
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
93 class CancelError(Exception): |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
94 pass |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
95 |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
96 |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
97 class InternalError(Exception): |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
98 pass |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
99 |
1def5b7edf9f
core, bridge: better GenericException handling
Goffi <goffi@goffi.org>
parents:
728
diff
changeset
|
100 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
101 class FeatureNotFound( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
102 Exception |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
103 ): # a disco feature/identity which is needed is not present |
944
e1842ebcb2f3
core, plugin XEP-0115: discovery refactoring:
Goffi <goffi@goffi.org>
parents:
893
diff
changeset
|
104 pass |
e1842ebcb2f3
core, plugin XEP-0115: discovery refactoring:
Goffi <goffi@goffi.org>
parents:
893
diff
changeset
|
105 |
e1842ebcb2f3
core, plugin XEP-0115: discovery refactoring:
Goffi <goffi@goffi.org>
parents:
893
diff
changeset
|
106 |
627
d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
107 class BridgeInitError(Exception): |
d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
108 pass |
d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
109 |
631
694f118d0cd5
plugin XEP-0055: implementation of Jabber Search
Goffi <goffi@goffi.org>
parents:
627
diff
changeset
|
110 |
627
d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
111 class BridgeExceptionNoService(Exception): |
d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
112 pass |
853
c2f6ada7858f
core (sqlite): automatic database update:
Goffi <goffi@goffi.org>
parents:
751
diff
changeset
|
113 |
1019 | 114 |
853
c2f6ada7858f
core (sqlite): automatic database update:
Goffi <goffi@goffi.org>
parents:
751
diff
changeset
|
115 class DatabaseError(Exception): |
c2f6ada7858f
core (sqlite): automatic database update:
Goffi <goffi@goffi.org>
parents:
751
diff
changeset
|
116 pass |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
117 |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
118 |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
119 class PasswordError(Exception): |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1019
diff
changeset
|
120 pass |
1052
e88bff4c8b77
core (XMPP): sendMessage refactoring:
Goffi <goffi@goffi.org>
parents:
1030
diff
changeset
|
121 |
1262
f8a8434dbac7
core: improved roster management + misc:
Goffi <goffi@goffi.org>
parents:
1052
diff
changeset
|
122 |
1290
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1262
diff
changeset
|
123 class PermissionError(Exception): |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1262
diff
changeset
|
124 pass |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1262
diff
changeset
|
125 |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1262
diff
changeset
|
126 |
3934
e345d93fb6e5
plugin OXPS: OpenPGP for XMPP Pubsub implementation:
Goffi <goffi@goffi.org>
parents:
3880
diff
changeset
|
127 class ParsingError(ValueError): |
1826
d80ccf4bf201
plugin blog import dotclear: this plugin import Dotclear 2 backups
Goffi <goffi@goffi.org>
parents:
1624
diff
changeset
|
128 pass |
1970
200cd707a46d
plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
Goffi <goffi@goffi.org>
parents:
1934
diff
changeset
|
129 |
200cd707a46d
plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
Goffi <goffi@goffi.org>
parents:
1934
diff
changeset
|
130 |
3745
a8c7e5cef0cb
comp AP gateway: signature checking, caching and threads management:
Goffi <goffi@goffi.org>
parents:
3248
diff
changeset
|
131 class EncryptionError(Exception): |
a8c7e5cef0cb
comp AP gateway: signature checking, caching and threads management:
Goffi <goffi@goffi.org>
parents:
3248
diff
changeset
|
132 """Invalid encryption""" |
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
133 |
3745
a8c7e5cef0cb
comp AP gateway: signature checking, caching and threads management:
Goffi <goffi@goffi.org>
parents:
3248
diff
changeset
|
134 pass |
a8c7e5cef0cb
comp AP gateway: signature checking, caching and threads management:
Goffi <goffi@goffi.org>
parents:
3248
diff
changeset
|
135 |
a8c7e5cef0cb
comp AP gateway: signature checking, caching and threads management:
Goffi <goffi@goffi.org>
parents:
3248
diff
changeset
|
136 |
1970
200cd707a46d
plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
Goffi <goffi@goffi.org>
parents:
1934
diff
changeset
|
137 # Something which need to be done is not available yet |
200cd707a46d
plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
Goffi <goffi@goffi.org>
parents:
1934
diff
changeset
|
138 class NotReady(Exception): |
200cd707a46d
plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
Goffi <goffi@goffi.org>
parents:
1934
diff
changeset
|
139 pass |
2687
e9cd473a2f46
core (xmpp): server certificate validation:
Goffi <goffi@goffi.org>
parents:
2674
diff
changeset
|
140 |
e9cd473a2f46
core (xmpp): server certificate validation:
Goffi <goffi@goffi.org>
parents:
2674
diff
changeset
|
141 |
3186
84b0c8b4dee0
plugin download, aesgcm: fixed handling of HTTP errors
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
142 class NetworkError(Exception): |
84b0c8b4dee0
plugin download, aesgcm: fixed handling of HTTP errors
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
143 """Something is wrong with a request (e.g. HTTP(S))""" |
84b0c8b4dee0
plugin download, aesgcm: fixed handling of HTTP errors
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
144 |
84b0c8b4dee0
plugin download, aesgcm: fixed handling of HTTP errors
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
145 |
2687
e9cd473a2f46
core (xmpp): server certificate validation:
Goffi <goffi@goffi.org>
parents:
2674
diff
changeset
|
146 class InvalidCertificate(Exception): |
e9cd473a2f46
core (xmpp): server certificate validation:
Goffi <goffi@goffi.org>
parents:
2674
diff
changeset
|
147 """A TLS certificate is not valid""" |
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
148 |
2687
e9cd473a2f46
core (xmpp): server certificate validation:
Goffi <goffi@goffi.org>
parents:
2674
diff
changeset
|
149 pass |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
150 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
151 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
152 class CommandException(RuntimeError): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
153 """An external command failed |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
154 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
155 stdout and stderr will be attached to the Exception |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
156 """ |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
157 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
158 def __init__(self, msg, stdout, stderr): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
159 super(CommandException, self).__init__(msg) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
160 self.stdout = stdout |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
2687
diff
changeset
|
161 self.stderr = stderr |