Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when importing non-existent service by returning the 404 message instead of nil #422

Merged
merged 1 commit into from
Jun 16, 2021
Merged

Improve error message when importing non-existent service by returning the 404 message instead of nil #422

merged 1 commit into from
Jun 16, 2021

Conversation

bengesoff
Copy link
Contributor

The change I described in #421.

Changes the error message from:

image

To:

image

…g the 404 instead of nil

Previously the error said:

Error: nil entry in ImportState results. This is always a bug with
the resource that is being imported. Please report this as
a bug to Terraform.

This was because a 404 on a service read would call `d.SetId("")` and then return `nil`.
To fix this, I just returned the error instead of `nil`, which meant the terminal output is now:

Error: 404 - Not Found
Cannot find service 'asfasd'
@Integralist Integralist added bug enhancement New feature or request and removed bug labels Jun 16, 2021
@Integralist Integralist merged commit fe2ee64 into fastly:main Jun 16, 2021
@bengesoff bengesoff deleted the non-existent-import-error-message branch June 16, 2021 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants