You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/08/18 01:42:10 UTC

[GitHub] [incubator-devlake] keon94 opened a new pull request, #2763: [feat-2134][framework]: Rework the error management code in the Backend

keon94 opened a new pull request, #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763

   ### ⚠️ &nbsp;&nbsp;Pre Checklist
   
   > Please complete _ALL_ items in this checklist, and remove before submitting
   
   - [ ] I have read through the [Contributing](https://devlake.apache.org/community/) Documentation & [PR Template](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
   - [ ] This PR is using a `label` (bug, feature etc.)
   - [ ] My code is has necessary documentation (if appropriate)
   - [ ] I have added any relevant tests
   - [ ] This section (**⚠️ &nbsp;&nbsp;Pre Checklist**) will be removed when submitting PR
   
   # Summary
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   ### Does this close any open issues?
   #2134
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #2763: [feat-2134][framework]: Rework the error management code in the Backend

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763#issuecomment-1222322842

   Example after including the optional "user-friendly" feature
   ![image](https://user-images.githubusercontent.com/25063936/185926326-23e3fefb-35eb-4c7c-a1db-ca8f89d835da.png)
   ![image](https://user-images.githubusercontent.com/25063936/185926459-30210cd2-0944-4d4c-b64d-7a1e5334561b.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #2763: [feat-2134][framework]: Rework the error management code in the Backend

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763#discussion_r948587535


##########
errors/impl.go:
##########
@@ -0,0 +1,116 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package errors
+
+import "fmt"
+import cerror "github.com/cockroachdb/errors"
+
+type (
+	crdbErrorImpl struct {
+		wrappedRaw error
+		wrapped    *crdbErrorImpl

Review Comment:
   we can potentially split this, into two strings: msg and usrMsg, and have the consumer code specify a custom User msg too optionally. The UserMessage() API would only then return the usrMsg fields if they are not empty



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #2763: [feat-2134][framework]: Rework the error management code in the Backend

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763#issuecomment-1218907639

   @hezyin @klesh @Startrekzky 
   
   I've been working on improving our error management infrastructure, and have implemetend a work-in-progress implementation of my ideas. Obviously, I'll have to go and find all the places where we are throwing errors and pass them through this new API. But I'd like to get your input as well before I do too much, so please have a look.
   
   Here's a screenshot of a temporary test suite I wrote:
   ![image](https://user-images.githubusercontent.com/25063936/185275605-e10e5f40-39c6-4537-8c95-42ff6e0cfb02.png)
   
   And the results (the errors printed)
   ![image](https://user-images.githubusercontent.com/25063936/185275736-35712b63-dd27-444e-8c8f-d0bea20eec91.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #2763: [feat-2134][framework]: Rework the error management code in the Backend

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763#issuecomment-1234860387

   @e2corporation with my new error messaging scheme [here](https://user-images.githubusercontent.com/25063936/188023608-1b5c6167-9869-4602-8fd1-e3909d821b6c.png) I am returning a multi-line cause-hierarchy of messages on the response. Let me know your thoughts. cc @klesh  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #2763: [feat-2134][framework]: Rework the error management code in the Backend

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763#issuecomment-1234748695

   Example backend log message with "test-jira-connection" erroring out
   ![image](https://user-images.githubusercontent.com/25063936/188006157-864fef9b-a375-42e1-a371-331d8a7f4553.png)
   
   Response as seen by the front-end
   ![image](https://user-images.githubusercontent.com/25063936/188006460-5beb4ee8-9b89-492c-8678-1d2a9d4e420b.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mindlesscloud commented on a diff in pull request #2763: [feat-2134][framework]: Rework the error management code in the Backend

Posted by GitBox <gi...@apache.org>.
mindlesscloud commented on code in PR #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763#discussion_r949230183


##########
errors/impl.go:
##########
@@ -0,0 +1,116 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package errors
+
+import "fmt"
+import cerror "github.com/cockroachdb/errors"
+
+type (
+	crdbErrorImpl struct {
+		wrappedRaw error
+		wrapped    *crdbErrorImpl
+		msg        string
+		t          *Type
+	}
+)
+
+func (e *crdbErrorImpl) Error() string {
+	return fmt.Sprintf("%+v", e.wrappedRaw)
+}
+
+func (e *crdbErrorImpl) Message() string {
+	return e.wrappedRaw.Error()
+}
+
+func (e *crdbErrorImpl) UserMessage() string {

Review Comment:
   It seems that the body of this function cloud be replaced by one line of code:
   ```go
   return strings.Join(e.getUserMessages(), "\ncaused by: ")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh merged pull request #2763: [feat-2134][framework]: Rework the error management code in the Backend

Posted by GitBox <gi...@apache.org>.
klesh merged PR #2763:
URL: https://github.com/apache/incubator-devlake/pull/2763


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org