From e5d4786371b2fd0d6aee39baca31a9b6241c1dad Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 14 May 2020 18:14:35 +0200 Subject: [PATCH] builder: simplify C error message --- vlib/net/http/http.v | 6 ++++-- vlib/v/builder/cc.v | 35 +++++++++++++++-------------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/vlib/net/http/http.v b/vlib/net/http/http.v index a31a4ac867..17075d9081 100644 --- a/vlib/net/http/http.v +++ b/vlib/net/http/http.v @@ -44,9 +44,11 @@ pub: status_code int } -pub fn new_request(method, url, data string) ?Request{ +pub fn new_request(method, url_, data string) ?Request{ + url := if method == 'GET' { url_ + '?' + data } else { url_ } + //println('new req() method=$method url="$url" dta="$data"') return Request{ - method: method + method: method.to_upper() url: url data: data } diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index e3dd853a25..ad02b1566a 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -10,6 +10,19 @@ import v.pref import v.util import term +const ( +c_error_info = ' +================== +C error. This should never happen. + +If you were not working with C interop, please raise an issue on GitHub: + +https://github.com/vlang/v/issues/new/choose + +You can also use #help on Discord: https://discord.gg/vlang +') + + fn todo() { } @@ -375,18 +388,7 @@ fn (mut v Builder) cc() { eword := 'error:' khighlight := if term.can_show_color_on_stdout() { term.red(eword) } else { eword } println(res.output.replace(eword, khighlight)) - verror(" -================== -C error. This should never happen. - -V compiler version: ${util.full_v_version()} -Host OS: ${pref.get_host_os().str()} -Target OS: $v.pref.os.str() - -If you were not working with C interop and are not sure about what's happening, -please put the whole output in a pastebin and contact us through the following ways with a link to the pastebin: -- Raise an issue on GitHub: https://github.com/vlang/v/issues/new/choose -- Ask a question in #help on Discord: https://discord.gg/vlang") + verror(c_error_info) } else { if res.output.len < 30 { println(res.output) @@ -400,14 +402,7 @@ please put the whole output in a pastebin and contact us through the following w println('==================') println('(Use `v -cg` to print the entire error message)\n') } - verror("C error. - -Please make sure that: -- You have all V dependencies installed. -- You did not declare a C function that was not included. (Try commenting your code that involves C interop) -- You are running the latest version of V. (Try running `v up` and rerunning your command) - -If you're confident that all of the above is true, please try running V with the `-cg` option which enables more debugging capabilities.\n") + verror(c_error_info) } } diff := time.ticks() - ticks