fix(services): report moving errors fully

This commit is contained in:
Houkime 2024-01-29 16:53:32 +00:00
parent 2863dd9763
commit e42da357fb

View file

@ -157,7 +157,7 @@ class ServicesMutations:
if service is None: if service is None:
return ServiceJobMutationReturn( return ServiceJobMutationReturn(
success=False, success=False,
message="Service not found.", message=f"Service not found: {input.service_id}",
code=404, code=404,
) )
# TODO: make serviceImmovable and BlockdeviceNotFound exceptions # TODO: make serviceImmovable and BlockdeviceNotFound exceptions
@ -165,7 +165,7 @@ class ServicesMutations:
if not service.is_movable(): if not service.is_movable():
return ServiceJobMutationReturn( return ServiceJobMutationReturn(
success=False, success=False,
message="Service is not movable.", message=f"Service is not movable: {service.get_display_name()}",
code=400, code=400,
service=service_to_graphql_service(service), service=service_to_graphql_service(service),
) )
@ -173,7 +173,7 @@ class ServicesMutations:
if volume is None: if volume is None:
return ServiceJobMutationReturn( return ServiceJobMutationReturn(
success=False, success=False,
message="Volume not found.", message=f"Volume not found: {input.location}",
code=404, code=404,
service=service_to_graphql_service(service), service=service_to_graphql_service(service),
) )
@ -197,7 +197,7 @@ class ServicesMutations:
else: else:
return ServiceJobMutationReturn( return ServiceJobMutationReturn(
success=False, success=False,
message=f"Service move failure: {job.status_text}", message=f"Service move failure: {job.status_text}: {job.error}",
code=400, code=400,
service=service_to_graphql_service(service), service=service_to_graphql_service(service),
job=job_to_api_job(job), job=job_to_api_job(job),