Skip to content

Conversation

@JakobDev
Copy link
Contributor

If saving failed, you now get a error, that shows why it failed.

2017-07-28_15 30 41
2017-07-28_15 27 02

local file = nil
local function innerSave()
file = fs.open( _sPath, "w" )
file, fileerr = fs.open( _sPath, "w" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileerr should not be global.

file.close()
end
return ok, err
return ok, err, fileerr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps instead of storing fileerr in an upvalue and returning, you should have error(fileerr, 0). That way you don't need the separate err and fileerr values. It would be worth checking how it handles out of space errors though - those will be generated through file.write instead.

@SquidDev
Copy link
Contributor

It's worth considering how this will interact with #377 - I'm presuming you'll get something like Error saving to bild.nfp: (/bild.nfp: Out of space), which could be a little weird. Obviously we should wait for that to be merged before worrying about it though :).

@Lupus590
Copy link
Contributor

@SquidDev Thinking ahead for that case, should the programs modify the error message to remove the file name from the error (the part in brackets)?

@SquidDev
Copy link
Contributor

SquidDev commented Aug 30, 2017

@Wilma456 What does this look like now that #377 has been merged? Would it be better to no longer show the file name, as it'll be included in the fs error message?

@JakobDev
Copy link
Contributor Author

Here's the new Style
2017-08-30_17 21 43

@SquidDev SquidDev mentioned this pull request Aug 15, 2018
ccserver pushed a commit to ccserver/ComputerCraft that referenced this pull request Sep 16, 2019
@JakobDev JakobDev closed this by deleting the head repository Jun 13, 2023
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

Successfully merging this pull request may close these issues.

4 participants