Comments (5)
That would then have to be a dependency for most classes though.
The other option is going to non-Http errors as was already suggested before and have a handler somewhere at the end that converts them to status codes (probably called by the responseWriter). And if new errors are introduced they would require also making a new handler for them (which can be combined in a CompositeHandler as usual then).
Both of these do make #23 a bit harder to solve I think :D
from communitysolidserver.
A factory is a definitely viable avenue indeed; it does feel a bit heavy to always have this injected (given how common errors are).
That would make me lean towards a more adapter-like solution, where (for instance) the back-end layer throws a simple "Not Found" / "Not Exists" error, which is a data object that is later translated into the right HTTP error. So basically, factory strategy, but the factory takes in data objects such that not all classes need this factory.
from communitysolidserver.
We need to fix this. When reviewing #52, I see Http
pop up everywhere because of this choice, and that feels very wrong, as this layer is HTTP-independent.
from communitysolidserver.
Maybe we want to make use of the factory pattern here, where we have an ErrorFactory that can be called to constructor errors of different types (that we define). During dependency injection, we could pass an HttpErrorFactory that would create HTTP-specific errors for our internal error types.
This would allows us to create other error factories later on, such as IpfsErrorfactory.
from communitysolidserver.
We have nice HTML errors now; I think that's enough.
from communitysolidserver.
Related Issues (20)
- New account creation does not validate input HOT 2
- Support for Range Headers HOT 1
- Something strange is happening with cache headers HOT 2
- Replace eslint configuration
- Abstract Authorizer's Credentials again
- Migration from v6 to v7 fails: [AppRunner] {Primary} error: Could not start the server: Unexpected end of JSON input HOT 27
- Docker builds started failing HOT 3
- Clicking "Authorize" Button too early leads to error page HOT 2
- Conditions are not supported in PATCH requests HOT 5
- `Forwarded`, `X-Forwarded-*` headers are trusted by default. HOT 2
- Prevent caching issues HOT 5
- Provide option to check hostname for static assets
- Internal lock folder in different location when using subdomains
- [Feature Request] PREP Notifications
- [Feature Request] Provide documentation or links to documentation how to deploy CSS on a production server HOT 5
- Features description 'here' links are broken HOT 2
- acl file modification without control rights HOT 3
- on v7 : markdown and html files are considered as text/turtle HOT 4
- CSS not able to handle a lot of HTTP requests. HOT 12
- Feature Request : To have the Solid Notifications with Websockets work with multiple CSS workers. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from communitysolidserver.