@@ -129,18 +129,18 @@ using interpolation if it makes sense.
129129
130130### Core API handler Errors
131131
132- Inside API handlers, the ` CarbideError ` data type should be used to construct errors. It should then be converted into
133- ` tonic::Status ` using ` .into() ` . All errors being derived from ` CarbideError ` assures that the errors will look uniform
132+ Inside API handlers, the ` NicoError ` data type should be used to construct errors. It should then be converted into
133+ ` tonic::Status ` using ` .into() ` . All errors being derived from ` NicoError ` assures that the errors will look uniform
134134to tenants.
135135
136- The ` CarbideError ` variant that is used should be selected based on whether the error gets returned due to the user
136+ The ` NicoError ` variant that is used should be selected based on whether the error gets returned due to the user
137137passing invalid arguments or due to the system not being able to handle the request correctly. Error variants that
138138should be used if the user passing invalid arguments can be ` InvalidArgument ` , ` InvalidConfiguration ` , ` NotFoundError `
139139or ` ConcurrentModificationError ` - these will map to "4xx-like" gRPC error codes. An example of a system-side error
140- would be ` CarbideError ::Internal` .
140+ would be ` NicoError ::Internal` .
141141
142142``` rust
143- // Avoid — constructing Status directly, bypassing `CarbideError ` error mapping
143+ // Avoid — constructing Status directly, bypassing `NicoError ` error mapping
144144pub async fn create_resource (
145145 api : & Api ,
146146 request : Request <rpc :: Resource >,
@@ -151,15 +151,15 @@ pub async fn create_resource(
151151 . ok_or_else (|| Status :: invalid_argument (" id is required" ))? ;
152152}
153153
154- // Prefer — uses `CarbideError ::InvalidArgument`
154+ // Prefer — uses `NicoError ::InvalidArgument`
155155pub async fn create_resource (
156156 api : & Api ,
157157 request : Request <rpc :: Resource >,
158158) -> Result <Response <()>, Status > {
159159 let resource = request . into_inner ();
160160 let id = resource
161161 . id
162- . ok_or (CarbideError :: InvalidArgument (" id is required" . into ()))? ;
162+ . ok_or (NicoError :: InvalidArgument (" id is required" . into ()))? ;
163163}
164164```
165165
@@ -172,14 +172,14 @@ checks for each meaningful combination of feature flags we support, which scales
172172
173173Cases where features * are* warranted:
174174
175- - For shared crates when only a subset of dependents need certain code: For example, the ` carbide_uuid ` is used by
176- several dependents, but only the ` carbide_api ` crate needs the sqlx conversions. We don't want e.g.
177- ` carbide_admin_cli ` to take a dependency on ` sqlx ` , so the sqlx conversions are behind a ` sqlx ` crate feature. But
175+ - For shared crates when only a subset of dependents need certain code: For example, the ` nico_uuid ` is used by
176+ several dependents, but only the ` nico_api ` crate needs the sqlx conversions. We don't want e.g.
177+ ` nico_admin_cli ` to take a dependency on ` sqlx ` , so the sqlx conversions are behind a ` sqlx ` crate feature. But
178178 this is covered by CI tests, since CI builds both the admin-cli and the api crate, both sets of features are
179179 exercised.
180180
181- - For supporting non-linux builds: The ` carbide_api ` crate needs to use types from the ` tss-esapi ` crate to support
182- validating secure-boot keys, but ` tss-esapi ` only builds on Linux. To support developers running ` carbide_api ` on
181+ - For supporting non-linux builds: The ` nico_api ` crate needs to use types from the ` tss-esapi ` crate to support
182+ validating secure-boot keys, but ` tss-esapi ` only builds on Linux. To support developers running ` nico_api ` on
183183 their Mac for testing, the parts which require ` tss-esapi ` are carefully carved out into a ` linux-build ` feature
184184 (which is enabled by default). We do not run CI tests with this feature disabled, so supporting a build without
185185 ` linux-build ` enabled is best-effort.
@@ -217,10 +217,10 @@ Avoid spawning background tasks without joining them. Any panics that happen in
217217the rest of the process unless you join them via ` JoinHandle::join() ` or add them to a ` JoinSet ` which is later awaited
218218with ` JoinSet::join_all() ` .
219219
220- For carbide -api, we use a single ` JoinSet ` to spawn all background tasks, and call ` join_all() ` to block "forever" until
220+ For nico -api, we use a single ` JoinSet ` to spawn all background tasks, and call ` join_all() ` to block "forever" until
221221the process is shut down. This makes it so any panics in the JoinSet will propagate to the main task, and crash the
222222process (which is what we want.) If you want to spawn background work, prefer accepting a ` &mut JoinSet ` and spawn your
223- background task into it. Your task can be constructed it inside ` carbide ::setup::initialize_and_spawn_controllers` ,
223+ background task into it. Your task can be constructed it inside ` nico ::setup::initialize_and_spawn_controllers` ,
224224which has a JoinSet it can pass to your ` start() ` function.
225225
226226Avoid using ` oneshot::Sender<()> ` as a cancellation signal, and prefer tokio_util's ` CancellationToken ` , which can
@@ -286,7 +286,7 @@ impl ClientlessBackgroundJob {
286286```
287287
288288Avoid mixing the approaches and returning an RAII handle for "client-less" background tasks, if it only exists to stop
289- the task when dropped. In carbide -api, there are many such client-less background jobs, and storing each of their
289+ the task when dropped. In nico -api, there are many such client-less background jobs, and storing each of their
290290handles for the correct lifetime is awkward and error-prone. Propagating a single top-level CancellationToken to each of
291291them is the preferred approach.
292292
0 commit comments