Skip to content

Commit

Permalink
Update Swift exceptions to be "@unchecked Sendable" (#2767)
Browse files Browse the repository at this point in the history
  • Loading branch information
externl authored Sep 24, 2024
1 parent 02738b3 commit 5ffe73e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions cpp/src/slice2swift/Gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
out << getUnqualified("Ice.UserException", swiftModule);
}
out << ", @unchecked Sendable";
out << sb;

const DataMemberList members = p->dataMembers();
Expand Down
6 changes: 4 additions & 2 deletions swift/src/Ice/UserException.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) ZeroC, Inc.

/// Base class for Ice user exceptions.
open class UserException: Exception {
/// Base class for Ice user exceptions. User exceptions are marked as "@unchecked Sendable" as the error
/// protocol requires them to be Sendable. However, the generated exception classes are not thread safe, and users
/// should not share instances of user exceptions between threads.
open class UserException: Exception, @unchecked Sendable {
public required init() {}

/// Gets the type ID of the class.
Expand Down

0 comments on commit 5ffe73e

Please sign in to comment.