Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Q# runtime exceptions are not raised as Python exceptions #556

@tcNickolas

Description

@tcNickolas

Describe the bug
Python host code doesn't receive runtime exceptions thrown by Q# code it calls.

To Reproduce
Steps to reproduce the behavior:
Q# code:

namespace Quantum.CircuitPuzzle {
    operation ThrowEx() : Int {
        fail "Throwing exception";
    }
}

Python host code:

import qsharp
from Quantum.CircuitPuzzle import ThrowEx

try:
    ThrowEx.simulate()
    print("Didn't catch exception")
except Exception:
    print("Caught exception")

Expected behavior
Python catching exception and printing "Caught exception".

System information

  • OS: Windows 11
  • dotnet iqsharp --version = 0.19.2109165653

Metadata

Metadata

Assignees

Labels

Area-PythonIssue relates to the Python client for the IQ# kernel.Kind-EnhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions