Comments (2)
Yeah, the use of Optional
for single object returns was questionable. Our team was pretty new to Java 8 and I'm not sure we did the right thing here. If you request an object that doesn't exist in Canvas, that is an error state that the calling application probably needs to know about. An exception allows you to pass back more details about the error so that the calling application might be able to handle it in some way. Just returning an empty Optional
kind of leaves you hanging as to what actually happened. Doesn't exist? Not authorized to view as current user? Network problem?
I'm kind of tempted to remove it but of course that would break everything.
from canvas-api.
A side note on this is that when the tool doesn't exist you also get logging warnings:
2019-11-14 15:50:55.440 ERROR 44831 --- [ main] edu.ksu.canvas.net.SimpleRestClient : Object not found in Canvas. Requested URL: https://instance.instructure.com/api/v1/accounts/1/external_tools/789
2019-11-14 15:50:55.443 ERROR 44831 --- [ main] edu.ksu.canvas.net.SimpleRestClient : Body of error response from Canvas: {"errors":[{"message":"The specified resource does not exist."}]}
from canvas-api.
Related Issues (13)
- Switch to a logging wrapper HOT 1
- log4j isn't listed as a dependency
- Updating course may change grade policy HOT 1
- CalendarApi params improvements + bugfix HOT 1
- Models use Integers instead of Longs HOT 1
- Request for new release version HOT 1
- Assignment missing attribute
- Assignment Model Missing Attribute For Overrides
- Updating fields to null HOT 9
- Document Reader & Writer non-thread-safety HOT 1
- Files && List files FilesController
- Dealing with 5xx responses from Canvas HOT 1
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 canvas-api.