mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
Although I brought up the idea here, I think the suggestion is good enough that it needs it's own thread...

I would like to see a /throwerror command that generates an error that propogrates back to a calling alias and sets $error to whatever is specified for arguments to /throwerror

In addition, an $errorsource identifer that reports the name of the alias throwing the error.

Code:
alias {
  dothis
  goto end
  :error
  echo -s $errorsource threw the error message: $error
  :end
}
alias dothis
  if ($1 == $null) /throwerror No arguments specified
  ; using /throwerror will also stop handling the alias
  echo -s only got here if $ $+ 1 is specified
}

Last edited by NaquadaServ; 16/04/07 01:50 PM.

NaquadaBomb
www.mirc-dll.com
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
Replace "alias dothis" with "alias dothis {"

Perhaps $errorline would be more useful then $errorsource, both would be cool though. smile

I really hope this will be added to mIRC. I could use it to trace a clear path an error took.

For example,
Code:
alias a {
  return $b
  :error
  echo -s error: $error ( $+ $script $+ , Line $errorline $+ )
  ; In this example it would echo
  ; error: $b : $c : Some Error (ScriptName, Line 2)
}
alias b {
  return $c
  :error
  ; $errorline here would equal 9
  /throwerror $ $+ b : $error
}
alias c {
  /throwerror $ $+ c : Some Error
}


NaquadaBomb
www.mirc-dll.com
Joined: Mar 2007
Posts: 60
S
Babel fish
Offline
Babel fish
S
Joined: Mar 2007
Posts: 60
Waita use that edit button :p

Anyway, this isn't a bad idea at all. This way the error that occurs can be found much for quickly.

I like this more than my error debug method of going through and echoing everything until i find the problem smile


"In order to succeed, your desire for success should be greater than your fear of failure."
Joined: Dec 2002
Posts: 2,028
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,028
Quote:
Waita use that edit button


Notice his reply was 2 days later, I think edit is only available for 2 hours.


Link Copied to Clipboard