nhat-phan / merge-request-integration

An Intellij IDE plugin which helps you manage Merge Request and do Code Review right in your IDE.
Other
175 stars 59 forks source link

Can't start a thread (add a comment) #57

Open theorlovsky opened 4 years ago

theorlovsky commented 4 years ago

When I try to add a comment, I get this error:

There was an error from server. 
400 (Bad request) "Note {:line_code=>["can't be blank", "must be a valid line code"]}" not given

I've tried both + gutter icon and the context menu, no difference. Replying inside an existing thread works fine.

Here's a stacktrace as well:

net.ntworld.mergeRequestIntegration.provider.ProviderException
    at net.ntworld.mergeRequestIntegrationIde.diff.DiffPresenterImpl$onCreateCommentRequested$1.invoke(DiffPresenterImpl.kt:153)
    at net.ntworld.mergeRequestIntegrationIde.diff.DiffPresenterImpl$onCreateCommentRequested$1.invoke(DiffPresenterImpl.kt:31)
    at net.ntworld.foundation.internal.ServiceBusProcessResultImpl.ifError(ServiceBusProcessResultImpl.kt:18)
    at net.ntworld.mergeRequestIntegrationIde.diff.DiffPresenterImpl.onCreateCommentRequested(DiffPresenterImpl.kt:148)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:127)
    at com.intellij.util.EventDispatcher.access$000(EventDispatcher.java:21)
    at com.intellij.util.EventDispatcher$1.invoke(EventDispatcher.java:85)
    at com.sun.proxy.$Proxy154.onCreateCommentRequested(Unknown Source)
    at net.ntworld.mergeRequestIntegrationIde.diff.AbstractDiffView$myThreadPresenterEventListener$1.onCreateCommentRequested(AbstractDiffView.kt:69)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:127)
    at com.intellij.util.EventDispatcher.access$000(EventDispatcher.java:21)
    at com.intellij.util.EventDispatcher$1.invoke(EventDispatcher.java:85)
    at com.sun.proxy.$Proxy162.onCreateCommentRequested(Unknown Source)
    at net.ntworld.mergeRequestIntegrationIde.diff.thread.ThreadPresenterImpl$myThreadViewActionListener$1.onCreateCommentRequested(ThreadPresenterImpl.kt:33)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:127)
    at com.intellij.util.EventDispatcher.access$000(EventDispatcher.java:21)
    at com.intellij.util.EventDispatcher$1.invoke(EventDispatcher.java:85)
    at com.sun.proxy.$Proxy161.onCreateCommentRequested(Unknown Source)
    at net.ntworld.mergeRequestIntegrationIde.diff.thread.ThreadViewImpl$myEditorComponentEventListener$1.onSubmitClicked(ThreadViewImpl.kt:93)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:127)
    at com.intellij.util.EventDispatcher.access$000(EventDispatcher.java:21)
    at com.intellij.util.EventDispatcher$1.invoke(EventDispatcher.java:85)
    at com.sun.proxy.$Proxy159.onSubmitClicked(Unknown Source)
    at net.ntworld.mergeRequestIntegrationIde.component.comment.EditorComponentImpl$MyAddCommentAction.actionPerformed(EditorComponentImpl.kt:69)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:280)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:274)
    at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:182)
    at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:155)
    at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:438)
    at java.desktop/java.awt.Component.processEvent(Component.java:6416)
    at java.desktop/java.awt.Container.processEvent(Container.java:2263)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:912)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:844)
    at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:739)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

I'm using the EE plugin version on MacOS 10.15.3 and WebStorm 2020.1

theorlovsky commented 4 years ago

Hmm, it works with other MRs, it was just one case so far

nhat-phan commented 4 years ago

Thank you for using the plugin.

I guess this bug happens because Gitlab & IDE have different way to create diff. So with IDE it maybe a actual line change but for Gitlab it's not, so sometime it doesn't work when you try to comment in certain position of code.

I keep this issue open and will find the way to improve it.

theorlovsky commented 4 years ago

So yeah, that isn't the only case anymore, it happens from time to time. Thank you, looking forward to see a patch. The plugin is awesome!

reitzig commented 3 years ago

I have 32 drafts and no way to tell which covered the error. As a stop-gap measure, please augment the error message with information about the offending comment. As an alternative, just skip error drafts and submit all others, leaving only those we have to move.

reitzig commented 3 years ago

FWIW, this can also happen in the web UI when adding a comment on a line GitLab doesn't consider part of the MR. For example, you can't add comments on lines in renamed (but otherwise unchanged) files. Same for (some) unchanged parts of changed files. I've been having issues with deleted lines as well, IIRC. So, the underlying issues are probably weird choices on the GitLab side of things. All we can hope for here is a UI that handles unexpected errors like that reasonably well.