Giter VIP home page Giter VIP logo

Comments (2)

humblearner avatar humblearner commented on September 25, 2024

Reason: https://github.com/StackStorm-Exchange/stackstorm-mysql/blob/master/actions/insert.py#L30 and https://github.com/StackStorm-Exchange/stackstorm-mysql/blob/master/actions/select.py#L38 we are returning only the result not the exception. There are two ways to solve this:

Solution 1:
Return both result and error
return (False, e)

$ st2 run mysql.insert connection="community"  table="user_registration" data="[email protected]"
.
id: 592385c92f28d409a61d1c6d
status: failed
parameters:
  connection: community
  data:
    email: [email protected]
  table: user_registration
result:
  exit_code: 0
  result: (1062, "Duplicate entry '[email protected]' for key 'email'")
  stderr: ''
  stdout: ''

Solution 2:
Raise exception
raise Exception(e)

$ st2 run mysql.insert connection="community"  table="user_registration" data="[email protected]"
.
id: 592385ec2f28d409a61d1c70
status: failed
parameters:
  connection: community
  data:
    email: [email protected]
  table: user_registration
result:
  exit_code: 1
  result: None
  stderr: "Traceback (most recent call last):
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 259, in <module>
    obj.run()
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 155, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/mysql/actions/insert.py", line 17, in run
    return self.insert(table, data)
  File "/opt/stackstorm/packs/mysql/actions/insert.py", line 31, in insert
    raise Exception(e)
Exception: (1062, "Duplicate entry '[email protected]' for key 'email'")
"
  stdout: ''

from stackstorm-mysql.

LindsayHill avatar LindsayHill commented on September 25, 2024

Fixed with #5

from stackstorm-mysql.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.