Skip to content

Commit 804abd7

Browse files
committed
Stop returning results from infallible fields
The async_graphql Object macro already wraps things in errors if it thinks it needs to so it's clearer to return the underlying type directly if it can't fail.
1 parent 513b214 commit 804abd7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/graphql/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ impl ScanPaths {
250250
/// The current configuration for an instrument
251251
impl CurrentConfiguration {
252252
/// The name of the instrument
253-
pub async fn instrument(&self) -> async_graphql::Result<&str> {
254-
Ok(self.db_config.name())
253+
pub async fn instrument(&self) -> &str {
254+
self.db_config.name()
255255
}
256256
/// The template used to build the path to the data directory for an instrument
257257
pub async fn directory_template(&self) -> async_graphql::Result<String> {
@@ -270,19 +270,19 @@ impl CurrentConfiguration {
270270
/// The latest scan number stored in the DB. This is the last scan number provided by this
271271
/// service but may not reflect the most recent scan number for an instrument if an external
272272
/// service (eg GDA) has incremented its own number tracker.
273-
pub async fn db_scan_number(&self) -> async_graphql::Result<u32> {
274-
Ok(self.db_config.scan_number())
273+
pub async fn db_scan_number(&self) -> u32 {
274+
self.db_config.scan_number()
275275
}
276276
/// The highest matching number file for this instrument in the configured tracking directory.
277277
/// May be null if no directory is available for this instrument or if there are no matching
278278
/// number files.
279-
pub async fn file_scan_number(&self) -> async_graphql::Result<Option<u32>> {
280-
Ok(self.high_file)
279+
pub async fn file_scan_number(&self) -> Option<u32> {
280+
self.high_file
281281
}
282282
/// The file extension used for the file based tracking, eg using an extension of 'ext'
283283
/// would create files `1.ext`, `2.ext` etc
284-
pub async fn tracker_file_extension(&self) -> async_graphql::Result<Option<&str>> {
285-
Ok(self.db_config.tracker_file_extension())
284+
pub async fn tracker_file_extension(&self) -> Option<&str> {
285+
self.db_config.tracker_file_extension()
286286
}
287287
}
288288

0 commit comments

Comments
 (0)