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

Tester says "internal error" on stage 5 for a user error #60

Open
rohitpaulk opened this issue Dec 19, 2023 · 1 comment
Open

Tester says "internal error" on stage 5 for a user error #60

rohitpaulk opened this issue Dec 19, 2023 · 1 comment

Comments

@rohitpaulk
Copy link
Member

Logs:

Dec 19 12:49:00 148e5315b37068 vector [stage-5] Creating some files & directories
Dec 19 12:49:00 148e5315b37068 vector [stage-5] $ ./your_git.sh write-tree
Dec 19 12:49:00 148e5315b37068 vector [your_program] aec2d24a22463ac63c7ec9684903f7f5ba292c79
Dec 19 12:49:00 148e5315b37068 vector [stage-5] Reading file at .git/objects/ae/c2d24a22463ac63c7ec9684903f7f5ba292c79
Dec 19 12:49:00 148e5315b37068 vector Error [stage-5] CodeCrafters internal error. Error reading .git/objects/ae/c2d24a22463ac63c7ec9684903f7f5ba292c79: open /tmp/worktree814524593/.git/objects/ae/c2d24a22463ac63c7ec9684903f7f5ba292c79: no such file or directory
Dec 19 12:49:00 148e5315b37068 vector [stage-5] Test failed

Here's our code that's supposed to filter user vs. internal error:

	if err == os.ErrNotExist {
		return fmt.Errorf("Did you write the tree object? Did not find a file in .git/objects/<first 2 chars of sha>/<remaining chars of sha>")
	} else if err != nil {
		return fmt.Errorf("CodeCrafters internal error. Error reading %v: %v", relativePath, err)
	}

Looks like this specific instance of "no such file or directory" isn't covered by os.ErrNotExist?

@rohitpaulk
Copy link
Member Author

Relevant ChatGPT convo: https://chat.openai.com/share/a8e0acc3-2a33-4e00-bc04-4ef8962c9673

Looks like we should use errors.Is instead?

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