Skip to content

Commit 26976c3

Browse files
committed
Changed filename
1 parent e13e007 commit 26976c3

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

013-custom-exception-on-all-sdks.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Add Custom Exceptions on All SDKs <!-- What do you want to call your `awesome_feature`? -->
2+
3+
- Implementation Owner: @lohanidamodar
4+
- Start Date: 14-02-2021
5+
- Target Date: N/A
6+
- Appwrite Issue:
7+
https://github.com/appwrite/sdk-for-flutter/issues/13
8+
9+
## Summary
10+
11+
[summary]: #summary
12+
13+
<!-- Brief explanation of the proposed contribution. Write your answer below. -->
14+
All Appwrite SDKs instead of exposing the internal details via existing exceptions, we want to throw custom AppwriteException. This will make it a lot easier for anyone using the SDK to understand the errors as all SDKs will have similar error response, as they all have same success response.
15+
16+
## Problem Statement (Step 1)
17+
18+
[problem-statement]: #problem-statement
19+
20+
**What problem are you trying to solve?**
21+
22+
<!-- Write your answer below. -->
23+
Right now, whenever there's error on Appwrite SDK, each throw platform exceptions. Each are different based on the platform. There should be unified experience in Appwrite SDK in whichever platforms we use. Introducing AppwriteException will resolve this issue.
24+
25+
26+
**What is the context or background in which this problem exists?**
27+
28+
<!-- Write your answer below. -->
29+
30+
We have multiple platform SDK each provide error information in different way. So we want to introduce unified way to throw errors accross multiple SDKs
31+
32+
**Once the proposal is implemented, how will the system change?**
33+
34+
<!-- Write your answer below. -->
35+
36+
All the SDKs will implement new AppwriteException class and throw AppwriteException with error details for all kinds of errors.
37+
38+
<!-- Please avoid discussing your proposed solution. -->
39+
40+
## Design proposal (Step 2)
41+
42+
[design-proposal]: #design-proposal
43+
44+
<!--
45+
This is the technical portion of the RFC. Explain the design in sufficient detail keeping in mind the following:
46+
47+
- Its interaction with other parts of the system is clear
48+
- It is reasonably clear how the contribution would be implemented
49+
- Dependencies on libraries, tools, projects or work that isn't yet complete
50+
- New API routes that need to be created or modifications to the existing routes (if needed)
51+
- Any breaking changes and ways in which we can ensure backward compatibility.
52+
- Use Cases
53+
- Goals
54+
- Deliverables
55+
- Changes to documentation
56+
- Ways to scale the solution
57+
58+
Ensure that you include examples, code-snippets etc. to allow the community to understand the proposed solution. **It would be best if the examples use naming conventions that you intend to use during the actual implementation so that changes can be suggested early on during the development.**
59+
60+
Write your answer below.
61+
62+
-->
63+
64+
## AppwriteException Class
65+
In each SDK implement AppwriteException class that should provide following details
66+
1. Message string
67+
2. Error code (mostly http status code)
68+
3. Appwrite server response data
69+
70+
## Handle Errors
71+
Every server call in Appwrite SDKs should handle error cases and throw AppwriteException with appropriate details.
72+
73+
## Exception Information in Docs
74+
The information regarding exceptions thrown, should be in the Appwrite SDKs docs for each SDK. Most SDKs have doc comments where we could include these or can create separate DOCs that will be generated for the SDK. The Appwrite DOCs should also include information about these errors with details on what information are returned, like the response value in the docs. The DOCs should include
75+
* What exceptions can a method throw
76+
* What are possible error codes and error messages
77+
* What do they mean, and how to debug
78+
* The exception information should be like response information in the DOCs, should include what structure and fields are available
79+
80+
## Error information in Swagger
81+
The error info in Swagger spec will be under responses and can look like this
82+
```json
83+
{
84+
"responses": {
85+
"200": {
86+
"description":"This is success response"
87+
},
88+
"400": {
89+
"description": "Bad Request. User ID must be provided",
90+
"schema": {
91+
"$ref":"#definitions/bad_request"
92+
}
93+
}
94+
}
95+
}
96+
```
97+
98+
99+
### Prior art
100+
101+
[prior-art]: #prior-art
102+
103+
<!--
104+
105+
Discuss prior art, both the good and the bad, in relation to this proposal. A
106+
few examples of what this can include are:
107+
108+
- Does this functionality exist in other software and what experience has their
109+
community had?
110+
- For other teams: What lessons can we learn from what other communities have
111+
done here?
112+
- Papers: Are there any published papers or great posts that discuss this? If
113+
you have some relevant papers to refer to, this can serve as a more detailed
114+
theoretical background.
115+
116+
This section is intended to encourage you as an author to think about the
117+
lessons from other software, provide readers of your RFC with a fuller picture.
118+
If there is no prior art, that is fine - your ideas are interesting to us
119+
whether they are brand new or if it is an adaptation from other software.
120+
121+
Write your answer below.
122+
-->
123+
124+
### Unresolved questions
125+
126+
[unresolved-questions]: #unresolved-questions
127+
128+
<!-- What parts of the design do you expect to resolve through the RFC process before this gets merged? -->
129+
130+
<!-- Write your answer below. -->
131+
132+
### Future possibilities
133+
134+
[future-possibilities]: #future-possibilities
135+
136+
<!-- This is also a good place to "dump ideas", if they are out of scope for the RFC you are writing but otherwise related. -->
137+
138+
<!-- Write your answer below. -->

0 commit comments

Comments
 (0)