[Sc-devel] Re: StartUp:run should protect itself?
James Harkins
jamshark70 at gmail.com
Tue Nov 20 09:05:45 PST 2007
No problem here.
By "more helpful output," do you mean using error.reportError instead
of postln?
hjh
On Nov 20, 2007, at 8:56 AM, Dan Stowell wrote:
> If there are no objections I'll commit this. It's similar to the code
> I posted (but with slightly more helpful output), very
> straightforward. Have been using it here.
>
> Dan
>
> 2007/11/16, Dan Stowell <danstowell at gmail.com>:
>> Hi -
>>
>> I'm just getting some of my SC stuff up and running on a new machine,
>> and I notice that if one of the functions added to StartUp bombs out
>> with some error (e.g. a ugen I forgot to install, stopping synthdef
>> compilation), that prevents other startup functions from running.
>> There's no protection against errors:
>>
>> *run {
>> done = true;
>> functions.do(_.value);
>> "StartUp done.".postln;
>> }
>>
>> Wouldn't it be better to insulate each separate function from the
>> others by wrapping it in a try{}?
>>
>> *run {
>> done = true;
>> functions.do({ |func|
>> func.try{|error|
>> "StartUp: an error has
>> occurred.".postln;
>> error.postln;
>> "Thrown during function:".postln;
>> func.postcs;
>> }
>> });
>> "StartUp done.".postln;
>> }
>>
>> The functions added to StartUp should all be independent, since
>> they're typically coming from different classes/scripts. If you want
>> one startup thing to depend on another, you can (and should) code
>> that
>> dependence in a single function to be added to StartUp.
>>
>> This sound sensible?
>>
>> Dan
>>
: H. James Harkins
: jamshark70 at dewdrop-world.net
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-devel/attachments/20071120/6432d596/attachment.htm
More information about the Sc-devel
mailing list