@@ -201,8 +201,12 @@ impl HospitalRegistry {
201201 . storage ( )
202202 . persistent ( )
203203 . get ( & key)
204+
205+ . unwrap_or_else ( || panic ! ( "Hospital not found" ) ) ;
206+
204207 . ok_or ( ContractError :: HospitalNotFound ) ?;
205208
209+
206210 hospital. metadata = metadata;
207211 env. storage ( ) . persistent ( ) . set ( & key, & hospital) ;
208212
@@ -225,7 +229,11 @@ impl HospitalRegistry {
225229 env. storage ( )
226230 . persistent ( )
227231 . get ( & key)
232+
233+ . unwrap_or_else ( || panic ! ( "Hospital not found" ) )
234+
228235 . ok_or ( ContractError :: HospitalNotFound )
236+
229237 }
230238
231239 /// Set full hospital configuration in one call
@@ -246,7 +254,11 @@ impl HospitalRegistry {
246254 env. storage ( )
247255 . persistent ( )
248256 . get ( & key)
257+
258+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) )
259+
249260 . ok_or ( ContractError :: HospitalConfigNotFound )
261+
250262 }
251263
252264 pub fn update_departments ( env : Env , wallet : Address , departments : Vec < Department > ) -> Result < ( ) , ContractError > {
@@ -258,8 +270,12 @@ impl HospitalRegistry {
258270 . storage ( )
259271 . persistent ( )
260272 . get ( & key)
273+
274+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
275+
261276 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
262277
278+
263279 config. departments = departments;
264280 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
265281
@@ -279,8 +295,12 @@ impl HospitalRegistry {
279295 . storage ( )
280296 . persistent ( )
281297 . get ( & key)
298+
299+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
300+
282301 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
283302
303+
284304 config. locations = locations;
285305 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
286306
@@ -298,8 +318,12 @@ impl HospitalRegistry {
298318 . storage ( )
299319 . persistent ( )
300320 . get ( & key)
321+
322+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
323+
301324 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
302325
326+
303327 config. equipment = equipment;
304328 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
305329
@@ -317,8 +341,12 @@ impl HospitalRegistry {
317341 . storage ( )
318342 . persistent ( )
319343 . get ( & key)
344+
345+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
346+
320347 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
321348
349+
322350 config. policies = policies;
323351 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
324352
@@ -336,8 +364,12 @@ impl HospitalRegistry {
336364 . storage ( )
337365 . persistent ( )
338366 . get ( & key)
367+
368+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
369+
339370 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
340371
372+
341373 config. alerts = alerts;
342374 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
343375
@@ -361,8 +393,12 @@ impl HospitalRegistry {
361393 . storage ( )
362394 . persistent ( )
363395 . get ( & key)
396+
397+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
398+
364399 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
365400
401+
366402 config. insurance_providers = insurance_providers;
367403 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
368404
@@ -380,8 +416,12 @@ impl HospitalRegistry {
380416 . storage ( )
381417 . persistent ( )
382418 . get ( & key)
419+
420+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
421+
383422 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
384423
424+
385425 config. billing = billing;
386426 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
387427
@@ -405,8 +445,12 @@ impl HospitalRegistry {
405445 . storage ( )
406446 . persistent ( )
407447 . get ( & key)
448+
449+ . unwrap_or_else ( || panic ! ( "Hospital config not found" ) ) ;
450+
408451 . ok_or ( ContractError :: HospitalConfigNotFound ) ?;
409452
453+
410454 config. emergency_protocols = protocols;
411455 env. storage ( ) . persistent ( ) . set ( & key, & config) ;
412456
0 commit comments