opencompose icon indicating copy to clipboard operation
opencompose copied to clipboard

Return better error in case of invalid input resource

Open concaf opened this issue 8 years ago • 2 comments

This is how opencompose errors when invalid input resource is passed -

[opencompose]$ opencompose convert -f https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-custombuild.json --output-dir -

ERROR: could not find decoder for resource 'https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-custombuild.json': unsupported version ""

This is how oc errors when an invalid input resource is passed -

[opencompose]$ oc create -f https://raw.githubusercontent.com/redhat-developer/opencompose/master/examples/hello-nginx.yaml

error: unable to decode "https://raw.githubusercontent.com/redhat-developer/opencompose/master/examples/hello-nginx.yaml": Object 'Kind' is missing in '{"services":[{"containers":[{"image":"tomaskral/nonroot-nginx","ports":[{"port":8080}]}],"name":"helloworld"}],"version":"0.1-dev"}'

We should improve the error, like we should return the reason why the resource is invalid and also return the resource in part or full.

concaf avatar Mar 16 '17 12:03 concaf

@containscafeine oc error is not visible, i think there seems to be some problem in formatting?

surajssd avatar Mar 16 '17 16:03 surajssd

@surajssd fixed

concaf avatar Mar 16 '17 20:03 concaf