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

Nonexistent Custom Fields cause confusing error messages #109

Open
uberbrady opened this issue Apr 19, 2023 · 1 comment
Open

Nonexistent Custom Fields cause confusing error messages #109

uberbrady opened this issue Apr 19, 2023 · 1 comment

Comments

@uberbrady
Copy link
Member

uberbrady commented Apr 19, 2023

Maybe this is something we fix via documentation - or commenting-out the Custom Fields parts of the example settings, I don't know.

But I've had a few customers now who have had 'problems' with jamf2snipe because they didn't read the documentation (and, let's be honest, nobody ever does), and just took the example settings file, tweaked it, and ran with it. We have the built-in expectation that all users will know how to use Snipe-IT, but I've tended to find that that expectation just isn't valid most of the time.

So we can either comment-out the Custom Fields bits (which feels wrong, tbh?) or make it so that you get a nicer, more glaring error when you try and set a nonexistent custom field. I don't know exactly how you'd do that though; I don't think Snipe-IT is going to give you a particularly useful error message. Though I'm not sure off the top of my head. One thing we certainly could do is hit the Custom Fields API (we'd have to parse _snipeit_ram_2 into just 2 for that), and confirm that the field exists, crashing out (with a convenient error message) if not?

Or maybe we just comment the dang things out. Not sure. _snipeit_mac_address_1 is pretty dang likely to be there (so long as no one has deleted it) so we could leave that one uncommented.

@uberbrady
Copy link
Member Author

I think I might be able to address this by changing one of the methods - It's kinda the 'universal request' method for all Snipe-IT calls - and making it so that it looks for JSON that returns {"status": "error"} and then tries to throw with the message - I'll play around with it now that I have a good test environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant