From d49319fc263343953d1f65dc633bc56c2df909f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadja=20von=20Reitzenstein=20=C4=8Cerpnjak?= Date: Tue, 7 May 2024 13:25:42 +0200 Subject: [PATCH] Make getBy* properly fallible --- resources.capnp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/resources.capnp b/resources.capnp index cb6e9e1..2305cd3 100644 --- a/resources.capnp +++ b/resources.capnp @@ -18,15 +18,19 @@ interface Resources { list @1 () -> ( resources :List(Resource) ); # Returns all resources that the user can currently disclose. - getByName @2 ( name :Text ) -> ( resource :Resource , dummy :UInt8 ); + getByName @2 ( name :Text ) -> Fallible(Resource, GetError); # Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource. - getByUrn @3 ( urn :Text ) -> ( resource :Resource ); + getByUrn @3 ( urn :Text ) -> Fallible(Resource, GetError); # Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource. - getByUrl @4 ( url :Text ) -> ( resource :Resource ); + getByUrl @4 ( url :Text ) -> Fallible(Resource, GetError); # Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource. + struct GetError { + notFound @0 :Void; + } + acceptToken @5 ( token :SturdyRef, project :Project ) -> Fallible(Claim, AcceptTokenError); acceptTokenSubstituteUser @7 ( token :SturdyRef, project :Project )