Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear error message when passing null values to updateMany #809

Open
LeonardMeyer opened this issue Dec 11, 2018 · 2 comments
Open

Unclear error message when passing null values to updateMany #809

LeonardMeyer opened this issue Dec 11, 2018 · 2 comments

Comments

@LeonardMeyer
Copy link

I was trying to do an updateMany() and have a nullable FK in my table. So I just put null inside my tuple... And here we are I guess ?

java.lang.RuntimeException: oops, null
	at scala.sys.package$.error(package.scala:27)
	at doobie.util.Put.unsafeSetNonNullable(put.scala:36)
	at doobie.util.Write$$anonfun$fromPut$2.apply(write.scala:64)
	at doobie.util.Write$$anonfun$fromPut$2.apply(write.scala:64)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$product$5.apply(write.scala:99)
	at doobie.util.LowerPriorityWrite$$anonfun$generic$2.apply(write.scala:110)
	at doobie.util.LowerPriorityWrite$$anonfun$generic$2.apply(write.scala:110)
	at doobie.util.Write$$anonfun$set$1.apply(write.scala:24)
	at doobie.util.Write$$anonfun$set$1.apply(write.scala:24)
	at doobie.free.KleisliInterpreter$$anonfun$primitive$1$$anonfun$apply$1.apply(kleisliinterpreter.scala:114)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:87)
	at cats.effect.internals.IORunLoop$.startCancelable(IORunLoop.scala:41)
	at cats.effect.internals.IOBracket$BracketStart.run(IOBracket.scala:86)
	at cats.effect.internals.Trampoline.cats$effect$internals$Trampoline$$immediateLoop(Trampoline.scala:70)
	at cats.effect.internals.Trampoline.startLoop(Trampoline.scala:36)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.cats$effect$internals$TrampolineEC$JVMTrampoline$$super$startLoop(TrampolineEC.scala:93)
	at cats.effect.internals.TrampolineEC$JVMTrampoline$$anonfun$startLoop$1.apply$mcV$sp(TrampolineEC.scala:93)
	at cats.effect.internals.TrampolineEC$JVMTrampoline$$anonfun$startLoop$1.apply(TrampolineEC.scala:93)
	at cats.effect.internals.TrampolineEC$JVMTrampoline$$anonfun$startLoop$1.apply(TrampolineEC.scala:93)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.startLoop(TrampolineEC.scala:92)
	at cats.effect.internals.Trampoline.execute(Trampoline.scala:43)
	at cats.effect.internals.TrampolineEC.execute(TrampolineEC.scala:44)
	at cats.effect.internals.IOBracket$BracketStart.apply(IOBracket.scala:72)
	at cats.effect.internals.IOBracket$BracketStart.apply(IOBracket.scala:52)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:136)
	at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:351)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:372)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:312)
	at cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
type Tupled = (String, String, String, String, String)
val tuples = ??? // construction with null as last column
Update[Tupled]("INSERT INTO table (stuff1, stuff2, stuff3, stuff4, stuff5) VALUES (?, ?, ?, ?, ?)")
.updateMany(tuples)

Of course I realized I should use Option so nothing too bad, but I think the error message could be hinting at it or something.

@anton-zen
Copy link

It's also a RuntimeException. I wonder if it could be more specific Exception class.

@jatcwang jatcwang added this to the 1.0 milestone Aug 19, 2022
@jatcwang
Copy link
Collaborator

Yes I think the error message can be improved

ulfryk added a commit to ulfryk/doobie that referenced this issue Nov 19, 2024
ulfryk added a commit to ulfryk/doobie that referenced this issue Nov 19, 2024
ulfryk added a commit to ulfryk/doobie that referenced this issue Nov 19, 2024
ulfryk added a commit to ulfryk/doobie that referenced this issue Nov 20, 2024
ulfryk added a commit to ulfryk/doobie that referenced this issue Nov 20, 2024
ulfryk added a commit to ulfryk/doobie that referenced this issue Nov 22, 2024
jatcwang added a commit that referenced this issue Nov 22, 2024
ulfryk added a commit to ulfryk/doobie that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants