search for: show_error

Displaying 20 results from an estimated 22 matches for "show_error".

2016 Jul 18
2
[PATCH] mllib: Getopt: fix integer parsing
...e funv, value paramv) CAMLreturn0; } +static int +strtoint (const char *arg) +{ + long int num; + + if (xstrtol (arg, NULL, 0, &num, NULL) != LONGINT_OK) { + fprintf (stderr, _("%s: '%s' is not a numeric value.\n"), + guestfs_int_program_name, arg); + show_error (EXIT_FAILURE); + } + + if (num <= INT_MIN || num >= INT_MAX) { + fprintf (stderr, _("%s: %s: integer out of range\n"), + guestfs_int_program_name, arg); + show_error (EXIT_FAILURE); + } + + return (int) num; +} + value guestfs_int_mllib_getopt_parse (value a...
2009 Feb 10
2
rescue_from for NoMethodError
Hi everyone, I was just trying to catch some exceptions in my app, for "Record Not Found" I used this in my application.rb file rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found rescue_from ActionController::NoMethodError, :with => :show_error private def record_not_found render :text => "404 Not Found", :status => 404 end def show_error(exception) render :text => exception.message; end and was quite successful but for "NoMethodError" I am trying the same but It isn''t working at a...
2017 Oct 14
2
Bug in replaceUsesOfWith: does not keep addrspace consistent in GEP
...<Function> getOrCreateFunction(Module &m, FunctionType *FTy, std::string name) { Function *F = m.getFunction(name); if (F) return F; return Function::Create(FTy, GlobalValue::ExternalLinkage, name, &m); }; static const bool SHOW_ERROR = false; int main() { static LLVMContext ctx; static IRBuilder<> Builder(ctx); Module *m = new Module("Module", ctx); Function *F = getOrCreateFunction( *m, FunctionType::get(Builder.getInt64Ty(), {PointerType::get(Builder....
2016 Jul 18
0
Re: [PATCH] mllib: Getopt: fix integer parsing
...t; +static int > +strtoint (const char *arg) > +{ > + long int num; > + > + if (xstrtol (arg, NULL, 0, &num, NULL) != LONGINT_OK) { > + fprintf (stderr, _("%s: '%s' is not a numeric value.\n"), > + guestfs_int_program_name, arg); > + show_error (EXIT_FAILURE); > + } > + > + if (num <= INT_MIN || num >= INT_MAX) { > + fprintf (stderr, _("%s: %s: integer out of range\n"), > + guestfs_int_program_name, arg); > + show_error (EXIT_FAILURE); These bounds are not tight enough. On 32 bit the...
2016 Jul 15
0
[PATCH 1/3] mllib: Fix parsing of integers on the command line and use correct int type.
...ptarg, "%d", &num) != 1) { + if (sscanf (optarg, "%ld%n", &num, &nchars) < 1 + || optarg[nchars] != '\0') { fprintf (stderr, _("'%s' is not a numeric value.\n"), guestfs_int_program_name); show_error (EXIT_FAILURE); @@ -284,7 +286,8 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu break; case 6: /* Set_int of string * int ref */ - if (sscanf (optarg, "%d", &num) != 1) { + if (sscanf (optarg, "%ld%n", &num, &...
2016 Jul 18
0
[PATCH v3 1/3] mllib: getopt: Further fix int parsing.
...char *arg) { long int num; - if (xstrtol (arg, NULL, 0, &num, NULL) != LONGINT_OK) { + if (xstrtol (arg, NULL, 0, &num, "") != LONGINT_OK) { fprintf (stderr, _("%s: '%s' is not a numeric value.\n"), guestfs_int_program_name, arg); show_error (EXIT_FAILURE); } - if (num <= -(2LL<<30) || num >= ((2LL<<30)-1)) { + if (num < -(1<<30) || num > (1<<30)-1) { fprintf (stderr, _("%s: %s: integer out of range\n"), guestfs_int_program_name, arg); show_error (EXIT_FAILURE...
2007 May 14
7
Help a newb with 0.3.1
...ion compatibilty on. Compiling routes.. merb init called Merb started with these options: --- :dist_root: /path/to/merb/mrblog/dist :allow_reloading: true :environment: development :merb_root: /path/to/merb/mrblog :cache_templates: true :use_mutex: true :config: dist/conf/mup.conf :host: 127.0.0.1 :show_error: true :port: "4000" :sql_session: true However any request to 127.0.0.1:4000 returns: Mon May 14 17:55:30 BST 2007: ERROR: undefined method `each'' for #<MerbUploadHandler:0x234bcfc> with nothing in the browser or in the log. Similarly, using a newly generated test a...
2007 Feb 15
1
wrong startup information in production environment
...============================== It''s "production" environment, and the showed "allow_reloading" / "cache_templates" information is wrong. I dig into the merb codes, find that merb show options information in merb_config(...), but some options(:allow_reloading/show_error/cache_templates) are likely to be changed in run(...) according the value of environment. So it''s better to show option informations in run(...) after all options have been decided. Thanks DavidLin
2016 Jul 18
2
Re: [PATCH] mllib: Getopt: fix integer parsing
...t char *arg) > > +{ > > + long int num; > > + > > + if (xstrtol (arg, NULL, 0, &num, NULL) != LONGINT_OK) { > > + fprintf (stderr, _("%s: '%s' is not a numeric value.\n"), > > + guestfs_int_program_name, arg); > > + show_error (EXIT_FAILURE); > > + } > > + > > + if (num <= INT_MIN || num >= INT_MAX) { > > + fprintf (stderr, _("%s: %s: integer out of range\n"), > > + guestfs_int_program_name, arg); > > + show_error (EXIT_FAILURE); > > These bou...
2008 Feb 27
8
ActiveRecord validation messages not I18N-friendly and enforces grammar
...39;'t be blank". This grammar works in English, but may not work in other languages. Furthermore, such messages are not always appropriate even in English. Suppose I want the message to be "Please enter your name". I can''t. Right now I work around this by writing my own show_errors() view helper method (an alternative for error_messages_on()), which only shows the '':message'' part of the errors (i.e. without the field part). In my models I then write: validates_presence_of :name, :message => "Please enter your name." Or, suppose I''m...
2016 Jul 18
4
[PATCH 1/3] mllib: Getopt: point to man page as additional help
...9;. --- mllib/getopt-c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c index bf40f91..3efd5d3 100644 --- a/mllib/getopt-c.c +++ b/mllib/getopt-c.c @@ -69,8 +69,8 @@ cleanup_option_list (void *ptr) static void __attribute__((noreturn)) show_error (int status) { - fprintf (stderr, _("Try `%s --help' for more information.\n"), - guestfs_int_program_name); + fprintf (stderr, _("Try `%s --help' or consult %s(1) for more information.\n"), + guestfs_int_program_name, guestfs_int_program_name);...
2006 Jul 22
2
redirect_to error
Hi, I have a redirect_to statement in a method that I would like to have at the end of the method to take you to a ''Success'' page if everything works. When I hit the redirect_to statement, ( redirect_to :action => ''show_success'' ) I get this in the browser: Application error Rails application failed to start properly" The development.log
2016 Jul 11
2
[PATCH v2] OCaml tools: add and use a Getopt module
...", column_wrap - columns, ' '); + + fprintf (f, "%s\n", String_val (docv)); + } + + /* Close the FILE to update the buffer. */ + fclose (f); + xwrite (STDOUT_FILENO, buf, buf_len); + + exit (EXIT_SUCCESS); + + CAMLreturn0; +} + +static void __attribute__((noreturn)) +show_error (int status) +{ + fprintf (stderr, _("Try `%s --help' for more information.\n"), + guestfs_int_program_name); + exit (status); +} + +static int +find_spec (value specsv, int specs_len, char opt) +{ + CAMLparam1 (specsv); + CAMLlocal1 (keysv); + int i, ret; + + for (i =...
2016 Jul 13
3
[PATCH v3 1/2] OCaml tools: add and use a Getopt module
...ptr; + struct option *p = opts; + + while (p->name != NULL) { + /* Cast the constness away, since we created the names on heap. */ + free ((char *) p->name); + ++p; + } + free (opts); +} + +#else +#define CLEANUP_FREE_OPTION_LIST +#endif + +static void __attribute__((noreturn)) +show_error (int status) +{ + fprintf (stderr, _("Try `%s --help' for more information.\n"), + guestfs_int_program_name); + exit (status); +} + +static int +find_spec (value specsv, int specs_len, char opt) +{ + CAMLparam1 (specsv); + CAMLlocal1 (keysv); + int i, ret; + + for (i =...
2017 Mar 31
0
[PATCH 2/3] Use Unicode single quotes ‘’ in place of `' in strings throughout.
...{ printf (_("%s: make a filesystem from a tar archive or files\n" diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c index 955dc1832..8336c3fb5 100644 --- a/mllib/getopt-c.c +++ b/mllib/getopt-c.c @@ -70,7 +70,7 @@ cleanup_option_list (void *ptr) static void __attribute__((noreturn)) show_error (int status) { - fprintf (stderr, _("Try `%s --help' or consult %s(1) for more information.\n"), + fprintf (stderr, _("Try ‘%s --help’ or consult %s(1) for more information.\n"), getprogname (), getprogname ()); exit (status); } diff --git a/p2v/main.c b/p...
2016 Jul 15
5
[PATCH 0/3] mllib: Various fixes and changes to Getopt module.
The second patch is obviously not complete yet - for discussion only. Rich.
2016 Sep 08
4
[PATCH 0/3] Use gnulib's getprogname
Hi, this series update libguestfs to a recent gnulib version, so that we can use its new getprogname module, and solve altogether one of the porting issues (the need for 'program_name' by the error module of gnulib), and have a single way to get the name of the current program. A number of changes in tools mostly, although mechanical. Thanks, Pino Toscano (3): Update gnulib to latest
2016 Jun 24
2
[PATCH] RFC: OCaml tools: add and use a Getopt module
...", column_wrap - columns, ' '); + + fprintf (f, "%s\n", String_val (docv)); + } + + /* Close the FILE to update the buffer. */ + fclose (f); + xwrite (STDOUT_FILENO, buf, buf_len); + + exit (EXIT_SUCCESS); + + CAMLreturn0; +} + +static void __attribute__((noreturn)) +show_error (int status) +{ + fprintf (stderr, _("Try `%s --help' for more information.\n"), + guestfs_int_program_name); + exit (status); +} + +static int +find_spec (value specsv, int specs_len, char opt) +{ + CAMLparam1 (specsv); + CAMLlocal1 (keysv); + int i, ret; + + for (i =...
2016 Jul 18
4
[PATCH v2 0/3] mllib: Various fixes and changes to Getopt module.
v1 -> v2: - Further fixes to Getopt int parsing. - Completed the L/S changes. - Fixed the test suite so it passes now. Also we don't need the special-case tests for 64 bit arch. Rich.
2016 Jul 18
4
[PATCH v3 0/3] mllib: Various fixes and changes to Getopt module.
v2 -> v3: - Add M variant and test it. Rich.