linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 5/5] trace-cruncher: Proper labeling of non libtracefs errors
Date: Fri,  1 Oct 2021 16:33:46 +0300	[thread overview]
Message-ID: <20211001133346.8217-6-y.karadz@gmail.com> (raw)
In-Reply-To: <20211001133346.8217-1-y.karadz@gmail.com>

Those particular errors are internal for trace-cruncher and have
nothing to do with libtracefs. The labels must indicate this.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/ftracepy-utils.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/ftracepy-utils.c b/src/ftracepy-utils.c
index 1a8a136..d8115f6 100644
--- a/src/ftracepy-utils.c
+++ b/src/ftracepy-utils.c
@@ -2031,14 +2031,15 @@ static PyObject *get_callback_func(const char *plugin_name, const char * py_call
 	py_name = PyUnicode_FromString(plugin_name);
 	py_module = PyImport_Import(py_name);
 	if (!py_module) {
-		TfsError_fmt(NULL, "Failed to import plugin \'%s\'",
+		PyErr_Format(TRACECRUNCHER_ERROR,
+			     "Failed to import plugin \'%s\'",
 			     plugin_name);
 		return NULL;
 	}
 
 	py_func = PyObject_GetAttrString(py_module, py_callback);
 	if (!py_func || !PyCallable_Check(py_func)) {
-		TfsError_fmt(NULL,
+		PyErr_Format(TRACECRUNCHER_ERROR,
 			     "Failed to import callback from \'%s\'",
 			     plugin_name);
 		return NULL;
@@ -2169,7 +2170,7 @@ PyObject *PyFtrace_trace_shell_process(PyObject *self, PyObject *args,
 
 	pid = fork();
 	if (pid < 0) {
-		TfsError_setstr(instance, "Failed to fork");
+		PyErr_SetString(TRACECRUNCHER_ERROR, "Failed to fork");
 		return NULL;
 	}
 
@@ -2215,7 +2216,8 @@ PyObject *PyFtrace_trace_process(PyObject *self, PyObject *args,
 		return NULL;
 
 	if (!PyList_CheckExact(py_argv)) {
-		TfsError_setstr(instance, "Failed to parse \'argv\' list");
+		PyErr_SetString(TRACECRUNCHER_ERROR,
+				"Failed to parse \'argv\' list");
 		return NULL;
 	}
 
@@ -2223,7 +2225,7 @@ PyObject *PyFtrace_trace_process(PyObject *self, PyObject *args,
 
 	pid = fork();
 	if (pid < 0) {
-		TfsError_setstr(instance, "Failed to fork");
+		PyErr_SetString(TRACECRUNCHER_ERROR, "Failed to fork");
 		return NULL;
 	}
 
-- 
2.30.2


      parent reply	other threads:[~2021-10-01 13:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 13:33 [PATCH 0/5] trace-cruncher: Improve error messages Yordan Karadzhov (VMware)
2021-10-01 13:33 ` [PATCH 1/5] trace-cruncher: Error on fail to destroy Yordan Karadzhov (VMware)
2021-10-01 13:33 ` [PATCH 2/5] trace-cruncher: Proper type name for the python objects Yordan Karadzhov (VMware)
2021-10-01 13:33 ` [PATCH 3/5] trace-cruncher: Correct misleading error message Yordan Karadzhov (VMware)
2021-10-01 13:33 ` [PATCH 4/5] trace-cruncher: Proper labeling of the libtracefs errors Yordan Karadzhov (VMware)
2021-10-01 13:33 ` Yordan Karadzhov (VMware) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211001133346.8217-6-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).