[Thread Prev][Thread Next][Index]
Re: [ferret_users] printing filename and line number at error
- To: Andrew Wittenberg - NOAA Federal <andrew.wittenberg@xxxxxxxx>
- Subject: Re: [ferret_users] printing filename and line number at error
- From: "Ansley C. Manke" <ansley.b.manke@xxxxxxxx>
- Date: Tue, 28 Jan 2020 11:00:29 -0800
- Arc-authentication-results: i=2; mx.google.com; dkim=pass header.i=@noaa.gov header.s=google header.b=KR2ngEOL; spf=pass (google.com: domain of ansley.b.manke@xxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=ansley.b.manke@xxxxxxxx; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=noaa.gov
- Arc-authentication-results: i=1; mx.google.com; dkim=pass header.i=@noaa.gov header.s=google header.b=KR2ngEOL; spf=pass (google.com: domain of ansley.b.manke@xxxxxxxx designates 209.85.220.41 as permitted sender) smtp.mailfrom=ansley.b.manke@xxxxxxxx; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=noaa.gov
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-archive:list-help:list-post:list-id:mailing-list:precedence :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=+1f38cqtNm51gq2GjPhX6a18XnOGyCgRmhb6N3sXzc8=; b=0F6YG98vLqXpBOFWJCXTxMmzFc6jgTfsnmEjbNif4c1lWhCZdEhSewyPVmusERjwQT dE7RDLEvSqRB9pai2B43iAjuRDe7NQ65YI7CVLLUqaYuRaHWFzerjbBZb09Ygaciwq7U Kb4MGTFgT3eZFLBXQoiXrndOGJPG/IB+y9P7QwiN0pYRctgmT/17LaBhElqs41CVIqpJ icLxe5UEWjaQN/Furf5J1vBpK7YrA7ICE9yJVwizYXmIuev8Cqo17a+g0JkL1Hos/Vpg dgSg9Ppd9ggCR/ozRrxrMPaQQVAaEmdEGpZ6hZnQ9Y59pWhVkZW3gP6zduQ7dedtkGcD WXWg==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=+1f38cqtNm51gq2GjPhX6a18XnOGyCgRmhb6N3sXzc8=; b=m9SZnRQnCbQAH6rTkFQ264Tt7388E1kr6SbhoLeyXVE4rGxGpZUj5SlhwWImvlBQKw Dfqk9pxrp8BdUJu8GuJ/eul0ooJITckIRvtr0fAV5IpcGKBNqZOcJqeOx2DFUTpPh8Zu 9sE2RzmC+YQZN220f5C6x0ZZocnuXj2lGPbGiisPjScjABsBoFTDfMGD/KJu7zeBvlbQ 3nmfWTgwSdjf9h5PdlCJyagxmEW/bzl2PKnnyvFUeL6wUxxTMdXBL0IUy84vEVHa0jkg pFD5ViTl+VDov/323djjfo1p+Ko51c76oX01oi2wo+2qFs3Mn9cBkiNPuPsXV3dzsIwV 4LWg==
- Arc-seal: i=2; a=rsa-sha256; t=1580238034; cv=pass; d=google.com; s=arc-20160816; b=OByDow5oeJ7qySMcMlophOZnVuecDaToqGAD4zHBLM78Aq2BTiMTiKCWZodU2ktWkz 4G5z2euCyucgxxP2HpSmYj16SbTHWIBt4on8bG2CBbjpFidRt+btWAYcZpMxZzpcsVVH XSpBntpEc5KfQ69HfG1ZkutFe+0ygUXQ/0FhsqEUEyr9jMnrrb0479hNqLWQ84jiUty9 1I3+baD6eIRrN17kv7a2111lpo/rc3lPo+JzaRbqFd04xA+3ZgbLSecHnQ0bPfGZvhOP Xt5wG6Q1sbcw47mtbuJL6vAcOChePvO+SoTw87Qp0MMHdLrqZVSWUK76nJTc/TmwubWM E2LQ==
- Arc-seal: i=1; a=rsa-sha256; t=1580238033; cv=none; d=google.com; s=arc-20160816; b=lJ2M4WICg20w5RtJ7ivN/W4uRZYplZky9wOW8j8lHUE8GFqN27It/fBW68n2pFAJ7L tKvIZmNOLKQ872eL1p9npHUwh3F5n5k2UktDvVf4XcjSiORscFIvfc+wys9R8j3KF+4l 7UAJ3k9TJnY/iZ+LlsXd/AZyc0DSE001sUMHAqWqgef+0wZvmaEh7qoYTlsHOz67R8T/ vpP8PH/4YopDT2mx2mBURkV4kD2bd24aSqxDqA9OgmiFhGPFFj3UYJV+d6l0Lc7aS/yH VKKruiWIiwSyjfaOgRz0ItasLEBp28/8q4sF+uzwPQwYNwd4svmK/nRUw/gLKTebK0iF ev9A==
- Cc: ferret_users@xxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa.gov; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive; bh=+1f38cqtNm51gq2GjPhX6a18XnOGyCgRmhb6N3sXzc8=; b=HqNL/086hip8FUG7j1xIGMExm7SC3B6hxwJl6uz2WJZQbR7+i9kXk4h9QXxSBtQbJX VSdUD+7Ygz0L122polU7raTCjDeTgK5PzMP7vU1fiX9g9yOdSOCqSztiuRsTg/vFjrrg lzIxgwqHYQGtfIGSLM/kRL/rxi/K5/uUlIwUIXrDi9nZAbJhhVOd9AltpGaFsXDwsvu0 /KOSd8GtwgOm1Bw2lIWW9+/lCmalfJloD8kEJ1+wizAlTSx790pttkUjaM0vWl22LITD 40x/wwWYp/pdqY+Z7e6TQXUdX1JtxK4/hUXJ6BDZ4XOvWk2AF+TNk4qgPgiNZRqYF3Rm 1gMA==
- In-reply-to: <CAKoe08TP9trvz13nB0EuaTyeuFVKA0fveFLEG6o5dtcV0FfCdQ@mail.gmail.com>
- List-archive: <https://groups.google.com/a/noaa.gov/group/ferret_users/>
- List-help: <https://support.google.com/a/noaa.gov/bin/topic.py?topic=25838>, <mailto:ferret_users+help@noaa.gov>
- List-id: <ferret_users.noaa.gov>
- List-post: <https://groups.google.com/a/noaa.gov/group/ferret_users/post>, <mailto:ferret_users@noaa.gov>
- Mailing-list: list ferret_users@xxxxxxxx; contact ferret_users+owners@xxxxxxxx
- References: <20200127153619.0a19cf13@gfi063209.klientdrift.uib.no> <CAEwQpaKMGfsm8L9atbnFA83o7kuq5ADe=vykH7PTf68D4g_VrA@mail.gmail.com> <20200128100921.0314b5f3@gfi063209.klientdrift.uib.no> <88e9ffce-8354-18b0-6293-358668f42710@noaa.gov> <CAKoe08TP9trvz13nB0EuaTyeuFVKA0fveFLEG6o5dtcV0FfCdQ@mail.gmail.com>
- Sender: owner-ferret_users@xxxxxxxx
- User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1
Hi Andrew,
In general the text of the line is already reported, as executed,
that is after parsing for symbol and grave-accent evaluations.
So, for instance if I have a script
! define_variable.jnl
cancel mode verify
let ($varname) = 12
and I call it with a symbol value that will cause an error
yes? set redirect/tee/clobber/file=run_script.log
yes? define symbol varname = 400
yes? go define_variable
! Enter_GO define_variable
cancel mode verify
**ERROR: command syntax: illegal name: 400
DEFINE VARIABLE 400 = 12
! Exit_GO
The result of the error-handling is the lines:
**ERROR: command syntax: illegal name: 400
DEFINE VARIABLE 400 = 12
And the "SET REDIRECT" at the start of the session has added the
lines starting with ! Enter_GO and ! Exit_GO.
so we're proposing here, to amend this to something like
**ERROR: command syntax: illegal name: 400
DEFINE VARIABLE 400 = 12
Running script define_variable.jnl
Or maybe that could coach us to go back and make use of SET
REDIRECT.
**ERROR: ...
Running script define_variable.jnl. Start session with SET
REDIRECT for a complete log
I'm not sure that any of this adds much more than the output of
the SET REDIRECT log. Some ideas:
-- Maybe some options on FshowGO to list some more context on the
GO commands?
-- The error listing shows the parsed command; also include the
un-parsed command?
-- A separate idea which is that when running interactively it'd
be nice to be able to get at the name of the current script being
run, for purposes of debugging a big tree of scripts.
-Ansley
On 1/28/2020 9:52 AM, Andrew Wittenberg
- NOAA Federal wrote:
Thanks
Ansley!
I agree that
(optionally) providing some context for error messages would
be very helpful. Perhaps could be implemented as a MODE
TRACEBACK. It could start with the name of the script, but
could also be extended into a full hierarchical traceback
showing the entire stack of calling scripts and the
last-executed lines within them.
If printing
out the line number isn't easy to do, then just as good
would be to print out the text of the most recent line or
command that was parsed. Presumably that text exists in
some stack in Ferret? Then the user could easily grep
through their script to locate that line.
Andrew
Hi Marco
I like the idea of including the name of the script in error
messages.
I would make use of that. I'm not sure whether also
including the
line-number would be easy to implement but we'll have a look
at these ideas.
Meanwhile a further tool is available for debugging.
Starting with
Ferret v6.9, redirect the output to a log file using SET
REDIRECT. Then
that log output includes lines that list entry and exit from
scripts,
and the Unix tool FshowGO makes a listing of the go-script
calls. This
is discussed here:
https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/SET#_VPINDEXENTRY_SET_REDIRECT
https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/introduction/UNIX-TOOLS#_FshowGO
And one more thing: if your set of calls includes scripts
that may
turn off mode verify, but you want to see the commands they
run, start
the session with
SET MODE VERIFY:always
which causes any CANCEL MODE VERIFY commands to be ignored.
-Ansley
On 1/28/2020 1:09 AM, Marco van Hulten wrote:
> Ryo—
>
> On 28 Jan 11:46 Ryo Furue wrote:
>> On Mon, Jan 27, 2020 at 11:39 PM Marco van Hulten
<Marco.Hulten@xxxxxx>
>> wrote:
>>
>>> When Ferret returns an error, is it possible to
print the filename and
>>> linenumber of the GO script?
>>> [ . . . ]
>>> This is especially useful in my case where I am
using jnl scripts that
>>> call other jnl scripts and so on.
>>>
>> I would certainly appreciate such a feature. But,
with "set mode verify",
>> you can usually track down where the error is.
> Yes, that's true enough. I now initialise a variable
"verbosity" and
> then use this line at the start of my scripts:
>
> \if `verbosity lt 2` then cancel mode verify else
set mode verify
>
> and cancel at the end of the script. That way VERIFY
is disabled when
> back at the prompt.
>
> —Marco
>
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement