Continue/Ignore error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
tty
Reply | Threaded
Open this post in threaded view
|

Continue/Ignore error

tty
Hi folks.

The following code is working very well, but when an Error occurs, I would like it to ignore the error and continue.

Transcript clear.
[(WikitextModule allSubclasses select:[:module  |  (module pagetitle indexOf:$/ ifAbsent:[0]) > 0])
do:[:m | |ss f d cmd shell content  ios|
ss := m pagetitle squeakToUtf8 findBetweenSubStrs: '/'.
d := ss collect:[:each | each] from: 1 to: (ss size -1).
"handle Sandbox and User: here"
((d at:1) = 'Sandbox') | ((d at:1) beginsWith:'User:')
ifTrue:[]
ifFalse:[
d := d inject:'' into:[:a :b | a, '/',  b].
f := ('lua',d, '/', ss last, '.lua') squeakToUtf8  .    "ios writes to shared by default"
cmd := 'mkdir -p shared/lua', d.   "commandshell writes to squeak root directory, so we prepende 'shared' to it"
Transcript show: (m name), ' : ', cmd; cr.
shell := PipeableOSProcess bash.
shell pipeFromOutput reader setNonBlocking.
shell exec: cmd.
(Delay forMilliseconds: 400) wait.
Transcript show: shell upToEnd ; cr.
shell close.
content := m lua squeakToUtf8.
ios := FileStream newFileNamed: f.
ios isNil
ifFalse:[
content storeOn: ios.
ios close.
]].
]] ifError:[:x :y | Transcript show: x;cr. y close. thisContext resume]

The error is 
WikitextModule613405370 : mkdir -p shared/lua/Road_data/strings/USA/KY

Error: cannot create OS pipe

I am assuming it is happening during the mkdir -p command during the shell sequence of code in bold above but that is not my question.
Although it could be happening in the ios portion. 

My question is how, after the Error is thrown do I continue the 'do:[:m...] block?

thanks for your time.



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
tty
Reply | Threaded
Open this post in threaded view
|

Re: Continue/Ignore error

tty
Well, after poking around seeing what I could do, it appears that Errors are
not resumeable.


Error>>
isResumable
        "Determine whether an exception is resumable."

        ^ false

So, I have to prevent the error from occuring in the first place.



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Continue/Ignore error

Christoph Thiede

Btw, you can ignore any Exception using #resumeUnchecked:. But whether this makes sense depends on your concrete use case ...


Von: Beginners <[hidden email]> im Auftrag von tty <[hidden email]>
Gesendet: Freitag, 30. August 2019 14:37:48
An: [hidden email]
Betreff: Re: [Newbies] Continue/Ignore error
 
Well, after poking around seeing what I could do, it appears that Errors are
not resumeable.


Error>>
isResumable
        "Determine whether an exception is resumable."

        ^ false

So, I have to prevent the error from occuring in the first place.



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Carpe Squeak!
tty
Reply | Threaded
Open this post in threaded view
|

Re: Continue/Ignore error

tty
Thank you



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners